Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions helm/data_helm_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ func checkChartDependenciesModel(ctx context.Context, model *HelmTemplateModel,
return false, diags
}

func applySetValue(base map[string]interface{}, set SetValue) diag.Diagnostics {
func applySetValue(base map[string]any, set SetValue) diag.Diagnostics {
var diags diag.Diagnostics

name := set.Name.ValueString()
Expand All @@ -933,12 +933,12 @@ func applySetValue(base map[string]interface{}, set SetValue) diag.Diagnostics {
diags.AddError("Failed parsing string value", fmt.Sprintf("Key %q with value %s: %s", name, value, err))
}
case "literal":
var literal interface{}
if err := yaml.Unmarshal([]byte(fmt.Sprintf("%s: %s", name, value)), &literal); err != nil {
var literal any
if err := yaml.Unmarshal(fmt.Appendf(nil, "%s: %s", name, value), &literal); err != nil {
diags.AddError("Failed parsing literal value", fmt.Sprintf("Key %q with literal value %s: %s", name, value, err))
return diags
}
if m, ok := literal.(map[string]interface{}); ok {
if m, ok := literal.(map[string]any); ok {
base[name] = m[name]
} else {
base[name] = literal
Expand All @@ -949,7 +949,7 @@ func applySetValue(base map[string]interface{}, set SetValue) diag.Diagnostics {
return diags
}

func applySetListValue(ctx context.Context, base map[string]interface{}, setList SetListValue) diag.Diagnostics {
func applySetListValue(_ context.Context, base map[string]any, setList SetListValue) diag.Diagnostics {
var diags diag.Diagnostics

name := setList.Name.ValueString()
Expand Down Expand Up @@ -981,7 +981,7 @@ func applySetListValue(ctx context.Context, base map[string]interface{}, setList
return diags
}

func applySetSensitiveValue(base map[string]interface{}, setSensitive SetSensitiveValue) diag.Diagnostics {
func applySetSensitiveValue(base map[string]any, setSensitive SetSensitiveValue) diag.Diagnostics {
var diags diag.Diagnostics

name := setSensitive.Name.ValueString()
Expand All @@ -997,6 +997,18 @@ func applySetSensitiveValue(base map[string]interface{}, setSensitive SetSensiti
if err := strvals.ParseIntoString(fmt.Sprintf("%s=%s", name, value), base); err != nil {
diags.AddError("Failed parsing sensitive string value", fmt.Sprintf("Failed parsing key %q with value %s: %s", name, value, err))
}
case "literal":
var literal any
if err := yaml.Unmarshal(fmt.Appendf(nil, "%s: %s", name, value), &literal); err != nil {
diags.AddError("Failed parsing sensitive literal value", fmt.Sprintf("Key %q with literal value %s: %s", name, value, err))
return diags
}

if m, ok := literal.(map[string]any); ok {
base[name] = m[name]
} else {
base[name] = literal
}
default:
diags.AddError("Unexpected type", fmt.Sprintf("Unexpected type for sensitive value: %s", valueType))
}
Expand Down
4 changes: 1 addition & 3 deletions helm/resource_helm_release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"testing"
"time"

"github.com/hashicorp/go-version"
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/knownvalue"
Expand Down Expand Up @@ -86,8 +85,7 @@ func TestAccResourceRelease_set_wo(t *testing.T) {

resource.Test(t, resource.TestCase{
TerraformVersionChecks: []tfversion.TerraformVersionCheck{
// FIXME use const from terraform-plugin-testing once v1.11.0 is released.
tfversion.SkipBelow(version.Must(version.NewVersion("1.11.0"))),
tfversion.SkipBelow(tfversion.Version1_11_0),
},
// PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: protoV6ProviderFactories(),
Expand Down
Loading