File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,20 @@ type ExternalName struct {
169
169
// given resource. Key should be the field path of the field to be referenced.
170
170
type References map [string ]Reference
171
171
172
+ // AddReference adds a reference configuration for the given field path.
173
+ // The fieldPath is the Terraform field path of the field to be referenced.
174
+ //
175
+ // Example: "vpc_id" or "forwarding_rule.certificate_name" in case of nested
176
+ // in another object.
177
+ func (r References ) AddReference (fieldPath string , ref Reference ) error {
178
+ if _ , ok := r [fieldPath ]; ok {
179
+ return fmt .Errorf ("reference for field %s already exists" , fieldPath )
180
+ }
181
+
182
+ r [fieldPath ] = ref
183
+ return nil
184
+ }
185
+
172
186
// Reference represents the Crossplane options used to generate
173
187
// reference resolvers for fields
174
188
type Reference struct {
You can’t perform that action at this time.
0 commit comments