diff --git a/deploy/crds/tf.galleybytes.com_terraforms_crd.yaml b/deploy/crds/tf.galleybytes.com_terraforms_crd.yaml index 8ee65d7..ab416fc 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 2426daf..e30ef3b 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 14d037c..5a7204c 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 08f83cb..77e927a 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 f5c978d..cff6fbd 100644 --- a/pkg/controllers/terraform_controller.go +++ b/pkg/controllers/terraform_controller.go @@ -1796,6 +1796,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)