diff --git a/go.mod b/go.mod index 95a8ed8c6..65fa9a701 100644 --- a/go.mod +++ b/go.mod @@ -104,6 +104,7 @@ require ( github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.21.0 // indirect github.com/hashicorp/terraform-json v0.22.1 // indirect + github.com/hashicorp/terraform-plugin-framework-jsontypes v0.2.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect diff --git a/go.sum b/go.sum index c0b1197cb..2ce8a247c 100644 --- a/go.sum +++ b/go.sum @@ -271,6 +271,8 @@ github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSey github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA= github.com/hashicorp/terraform-plugin-framework v1.11.0 h1:M7+9zBArexHFXDx/pKTxjE6n/2UCXY6b8FIq9ZYhwfE= github.com/hashicorp/terraform-plugin-framework v1.11.0/go.mod h1:qBXLDn69kM97NNVi/MQ9qgd1uWWsVftGSnygYG1tImM= +github.com/hashicorp/terraform-plugin-framework-jsontypes v0.2.0 h1:SJXL5FfJJm17554Kpt9jFXngdM6fXbnUnZ6iT2IeiYA= +github.com/hashicorp/terraform-plugin-framework-jsontypes v0.2.0/go.mod h1:p0phD0IYhsu9bR4+6OetVvvH59I6LwjXGnTVEr8ox6E= github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E= github.com/hashicorp/terraform-plugin-framework-validators v0.13.0/go.mod h1:wGeI02gEhj9nPANU62F2jCaHjXulejm/X+af4PdZaNo= github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co= diff --git a/helm/provider.go b/helm/provider.go index 3bc02b061..7b6c45cb2 100644 --- a/helm/provider.go +++ b/helm/provider.go @@ -13,6 +13,7 @@ import ( "strings" "sync" + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" @@ -68,7 +69,7 @@ type HelmProviderModel struct { // ExperimentsConfigModel configures the experiments that are enabled or disabled type ExperimentsConfigModel struct { - Manifest types.Bool `tfsdk:"manifest"` + Manifest jsontypes.Normalized `tfsdk:"manifest"` } // RegistryConfigModel configures an OCI registry @@ -181,7 +182,8 @@ func (p *HelmProvider) Schema(ctx context.Context, req provider.SchemaRequest, r func experimentsSchema() map[string]schema.Attribute { return map[string]schema.Attribute{ - "manifest": schema.BoolAttribute{ + "manifest": schema.StringAttribute{ + CustomType: jsontypes.NormalizedType{}, Optional: true, Description: "Enable full diff by storing the rendered manifest in the state.", }, @@ -489,9 +491,9 @@ func (p *HelmProvider) Configure(ctx context.Context, req provider.ConfigureRequ return } - manifestExperiment := false - if config.Experiments != nil { - manifestExperiment = config.Experiments.Manifest.ValueBool() + manifestExperiment := jsontypes.Normalized{} + if config.Experiments != nil && !config.Experiments.Manifest.IsNull() { + manifestExperiment = config.Experiments.Manifest } var execAttrValue attr.Value = types.ObjectNull(execSchemaAttrTypes()) @@ -559,13 +561,13 @@ func (p *HelmProvider) Configure(ctx context.Context, req provider.ConfigureRequ BurstLimit: types.Int64Value(burstLimit), Kubernetes: kubernetesConfigObjectValue, Experiments: &ExperimentsConfigModel{ - Manifest: types.BoolValue(manifestExperiment), + Manifest: manifestExperiment, }, }, Settings: settings, HelmDriver: helmDriver, Experiments: map[string]bool{ - "manifest": manifestExperiment, + "manifest": !manifestExperiment.IsNull(), }, } registryClient, err := registry.NewClient()