diff --git a/helm/data_helm_template.go b/helm/data_helm_template.go index 4c1ad0127..e77d7832e 100644 --- a/helm/data_helm_template.go +++ b/helm/data_helm_template.go @@ -64,6 +64,7 @@ type HelmTemplateModel struct { Devel types.Bool `tfsdk:"devel"` DisableOpenAPIValidation types.Bool `tfsdk:"disable_openapi_validation"` DisableWebhooks types.Bool `tfsdk:"disable_webhooks"` + DisableSchemaValidation types.Bool `tfsdk:"disable_schema_validation"` ID types.String `tfsdk:"id"` IncludeCRDs types.Bool `tfsdk:"include_crds"` IsUpgrade types.Bool `tfsdk:"is_upgrade"` @@ -181,6 +182,10 @@ func (d *HelmTemplate) Schema(ctx context.Context, req datasource.SchemaRequest, Optional: true, Description: "Prevent hooks from running.", }, + "disable_schema_validation": schema.BoolAttribute{ + Optional: true, + Description: "If set, the schema validation is disabled.", + }, "id": schema.StringAttribute{ Computed: true, }, @@ -439,6 +444,9 @@ func (d *HelmTemplate) Read(ctx context.Context, req datasource.ReadRequest, res if state.DisableOpenAPIValidation.IsNull() || state.DisableOpenAPIValidation.IsUnknown() { state.DisableOpenAPIValidation = types.BoolValue(false) } + if state.DisableSchemaValidation.IsNull() || state.DisableSchemaValidation.IsUnknown() { + state.DisableSchemaValidation = types.BoolValue(false) + } if state.Wait.IsNull() || state.Wait.IsUnknown() { state.Wait = types.BoolValue(false) } @@ -563,6 +571,7 @@ func (d *HelmTemplate) Read(ctx context.Context, req datasource.ReadRequest, res client.DependencyUpdate = state.DependencyUpdate.ValueBool() client.DisableHooks = state.DisableWebhooks.ValueBool() client.DisableOpenAPIValidation = state.DisableOpenAPIValidation.ValueBool() + client.DisableSchemaValidation = state.DisableSchemaValidation.ValueBool() client.Atomic = state.Atomic.ValueBool() client.Replace = state.Replace.ValueBool() client.SkipCRDs = state.SkipCrds.ValueBool() diff --git a/helm/resource_helm_release.go b/helm/resource_helm_release.go index ec9feb725..04777b422 100644 --- a/helm/resource_helm_release.go +++ b/helm/resource_helm_release.go @@ -70,6 +70,7 @@ type HelmReleaseModel struct { DisableCrdHooks types.Bool `tfsdk:"disable_crd_hooks"` DisableOpenapiValidation types.Bool `tfsdk:"disable_openapi_validation"` DisableWebhooks types.Bool `tfsdk:"disable_webhooks"` + DisableSchemaValidation types.Bool `tfsdk:"disable_schema_validation"` ForceUpdate types.Bool `tfsdk:"force_update"` ID types.String `tfsdk:"id"` Keyring types.String `tfsdk:"keyring"` @@ -114,6 +115,7 @@ var defaultAttributes = map[string]interface{}{ "dependency_update": false, "disable_crd_hooks": false, "disable_openapi_validation": false, + "disable_schema_validation": false, "disable_webhooks": false, "force_update": false, "lint": false, @@ -307,6 +309,12 @@ func (r *HelmRelease) Schema(ctx context.Context, req resource.SchemaRequest, re Default: booldefault.StaticBool(defaultAttributes["disable_openapi_validation"].(bool)), Description: "If set, the installation process will not validate rendered templates against the Kubernetes OpenAPI Schema", }, + "disable_schema_validation": schema.BoolAttribute{ + Optional: true, + Computed: true, + Default: booldefault.StaticBool(defaultAttributes["disable_schema_validation"].(bool)), + Description: "If set, the installation process will not validate rendered templates against the Kubernetes OpenAPI Schema", + }, "disable_webhooks": schema.BoolAttribute{ Optional: true, Computed: true, @@ -771,6 +779,7 @@ func (r *HelmRelease) Create(ctx context.Context, req resource.CreateRequest, re client.SkipCRDs = state.SkipCrds.ValueBool() client.SubNotes = state.RenderSubchartNotes.ValueBool() client.DisableOpenAPIValidation = state.DisableOpenapiValidation.ValueBool() + client.DisableSchemaValidation = state.DisableSchemaValidation.ValueBool() client.Replace = state.Replace.ValueBool() client.Description = state.Description.ValueString() client.CreateNamespace = state.CreateNamespace.ValueBool() @@ -976,6 +985,7 @@ func (r *HelmRelease) Update(ctx context.Context, req resource.UpdateRequest, re client.SkipCRDs = plan.SkipCrds.ValueBool() client.SubNotes = plan.RenderSubchartNotes.ValueBool() client.DisableOpenAPIValidation = plan.DisableOpenapiValidation.ValueBool() + client.DisableSchemaValidation = plan.DisableSchemaValidation.ValueBool() client.Force = plan.ForceUpdate.ValueBool() client.ResetValues = plan.ResetValues.ValueBool() client.ReuseValues = plan.ReuseValues.ValueBool() @@ -1815,6 +1825,7 @@ func (r *HelmRelease) ModifyPlan(ctx context.Context, req resource.ModifyPlanReq install.SkipCRDs = plan.SkipCrds.ValueBool() install.SubNotes = plan.RenderSubchartNotes.ValueBool() install.DisableOpenAPIValidation = plan.DisableOpenapiValidation.ValueBool() + install.DisableSchemaValidation = plan.DisableSchemaValidation.ValueBool() install.Replace = plan.Replace.ValueBool() install.Description = plan.Description.ValueString() install.CreateNamespace = plan.CreateNamespace.ValueBool() diff --git a/helm/resource_helm_release_test.go b/helm/resource_helm_release_test.go index ca256589d..c98958203 100644 --- a/helm/resource_helm_release_test.go +++ b/helm/resource_helm_release_test.go @@ -181,6 +181,7 @@ func TestAccResourceRelease_import(t *testing.T) { resource.TestCheckResourceAttr("helm_release.imported", "dependency_update", "false"), resource.TestCheckResourceAttr("helm_release.imported", "replace", "false"), resource.TestCheckResourceAttr("helm_release.imported", "disable_openapi_validation", "false"), + resource.TestCheckResourceAttr("helm_release.imported", "disable_scheme_validation", "false"), resource.TestCheckResourceAttr("helm_release.imported", "create_namespace", "false"), ), },