diff --git a/deploy/crds/tf.galleybytes.com_terraforms_crd.yaml b/deploy/crds/tf.galleybytes.com_terraforms_crd.yaml index 8ee65d7c697c63f9948a281a490273fb5ea70f0d..ab416fc61c6829c9a8353383f126c9b967b44e5d 100644 --- a/deploy/crds/tf.galleybytes.com_terraforms_crd.yaml +++ b/deploy/crds/tf.galleybytes.com_terraforms_crd.yaml @@ -2472,6 +2472,16 @@ spec: terraform module. properties: configMapSeclector: + description: Typoed form of configMapSelector + properties: + key: + type: string + name: + type: string + required: + - name + type: object + configMapSelector: description: "ConfigMapSelector is an option that points to an existing configmap on the executing cluster. The configmap is expected to contains has the terraform module (ie keys ending diff --git a/pkg/apis/tf/v1beta1/terraform_types.go b/pkg/apis/tf/v1beta1/terraform_types.go index 2426dafde79a3bb6d747ba53e8183bd0b6bc21f1..e30ef3b67317cab7b04706e6357dd5a23c3347c4 100644 --- a/pkg/apis/tf/v1beta1/terraform_types.go +++ b/pkg/apis/tf/v1beta1/terraform_types.go @@ -257,7 +257,10 @@ type Module struct { // // If a key is defined, the value is used as the module else the entirety of the data objects will be // loaded as files. - ConfigMapSelector *ConfigMapSelector `json:"configMapSeclector,omitempty"` + ConfigMapSelector *ConfigMapSelector `json:"configMapSelector,omitempty"` + + // Typoed form of configMapSelector + ConfigMapSeclector_x *ConfigMapSelector `json:"configMapSeclector,omitempty"` // Inline used to define an entire terraform module inline and then mounted in the TFO_MAIN_MODULE path. Inline string `json:"inline,omitempty"` diff --git a/pkg/apis/tf/v1beta1/zz_generated.deepcopy.go b/pkg/apis/tf/v1beta1/zz_generated.deepcopy.go index 14d037c057912017218e9d337232bb65ac417271..5a7204cc49efe7528ba831436c89c9bbdb050254 100644 --- a/pkg/apis/tf/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/tf/v1beta1/zz_generated.deepcopy.go @@ -199,6 +199,11 @@ func (in *Module) DeepCopyInto(out *Module) { *out = new(ConfigMapSelector) **out = **in } + if in.ConfigMapSeclector_x != nil { + in, out := &in.ConfigMapSeclector_x, &out.ConfigMapSeclector_x + *out = new(ConfigMapSelector) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Module. diff --git a/pkg/apis/tf/v1beta1/zz_generated.openapi.go b/pkg/apis/tf/v1beta1/zz_generated.openapi.go index 08f83cbd0abf378a848d871d6f048c6e56df3b81..77e927af3a33332c13ad39470764d83de741300b 100644 --- a/pkg/apis/tf/v1beta1/zz_generated.openapi.go +++ b/pkg/apis/tf/v1beta1/zz_generated.openapi.go @@ -317,12 +317,18 @@ func schema_pkg_apis_tf_v1beta1_Module(ref common.ReferenceCallback) common.Open Format: "", }, }, - "configMapSeclector": { + "configMapSelector": { SchemaProps: spec.SchemaProps{ Description: "ConfigMapSelector is an option that points to an existing configmap on the executing cluster. The configmap is expected to contains has the terraform module (ie keys ending with .tf). The configmap would need to live in the same namespace as the tfo resource.\n\nThe configmap is mounted as a volume and put into the TFO_MAIN_MODULE path by the setup task.\n\nIf a key is defined, the value is used as the module else the entirety of the data objects will be loaded as files.", Ref: ref("github.com/galleybytes/terraform-operator/pkg/apis/tf/v1beta1.ConfigMapSelector"), }, }, + "configMapSeclector": { + SchemaProps: spec.SchemaProps{ + Description: "Typoed form of configMapSelector", + Ref: ref("github.com/galleybytes/terraform-operator/pkg/apis/tf/v1beta1.ConfigMapSelector"), + }, + }, "inline": { SchemaProps: spec.SchemaProps{ Description: "Inline used to define an entire terraform module inline and then mounted in the TFO_MAIN_MODULE path.", diff --git a/pkg/controllers/terraform_controller.go b/pkg/controllers/terraform_controller.go index 6ddf2fe91adb942088319c2b3b0fea31ba997cf7..ca0673ff34f22ce5df0a1690f8216649ae94f200 100644 --- a/pkg/controllers/terraform_controller.go +++ b/pkg/controllers/terraform_controller.go @@ -1760,6 +1760,12 @@ func (r *ReconcileTerraform) setupAndRun(ctx context.Context, tf *tfv1beta1.Terr // Add add inline to configmap and instruct the pod to fetch the // configmap as the main module runOpts.mainModulePluginData["inline-module.tf"] = tf.Spec.TerraformModule.Inline + } else if tf.Spec.TerraformModule.ConfigMapSeclector_x != nil { + b, err := json.Marshal(tf.Spec.TerraformModule.ConfigMapSeclector_x) + if err != nil { + return err + } + runOpts.mainModulePluginData[".__TFO__ConfigMapModule.json"] = string(b) } else if tf.Spec.TerraformModule.ConfigMapSelector != nil { // Instruct the setup pod to fetch the configmap as the main module b, err := json.Marshal(tf.Spec.TerraformModule.ConfigMapSelector)