From b54c10b832105da5a48685fa312cc90a59d9591d Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 1 Oct 2024 11:22:44 -0700 Subject: [PATCH] Remove embed_credentials default from tfdyn --- .../terraform/tfdyn/convert_dashboard.go | 9 ----- .../terraform/tfdyn/convert_dashboard_test.go | 35 ------------------- 2 files changed, 44 deletions(-) diff --git a/bundle/deploy/terraform/tfdyn/convert_dashboard.go b/bundle/deploy/terraform/tfdyn/convert_dashboard.go index 13be530b8..f905ba999 100644 --- a/bundle/deploy/terraform/tfdyn/convert_dashboard.go +++ b/bundle/deploy/terraform/tfdyn/convert_dashboard.go @@ -46,15 +46,6 @@ func convertDashboardResource(ctx context.Context, vin dyn.Value) (dyn.Value, er } } - // Default the "embed_credentials" field to "false", if not already set. - // This is different from the behavior in the Terraform provider, so we make it explicit. - if _, ok := vout.Get("embed_credentials").AsBool(); !ok { - vout, err = dyn.Set(vout, "embed_credentials", dyn.V(false)) - if err != nil { - return dyn.InvalidValue, fmt.Errorf("failed to set embed_credentials: %w", err) - } - } - return vout, nil } diff --git a/bundle/deploy/terraform/tfdyn/convert_dashboard_test.go b/bundle/deploy/terraform/tfdyn/convert_dashboard_test.go index 886be16f1..dfb2ffa44 100644 --- a/bundle/deploy/terraform/tfdyn/convert_dashboard_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_dashboard_test.go @@ -2,7 +2,6 @@ package tfdyn import ( "context" - "fmt" "testing" "github.com/databricks/cli/bundle/config/resources" @@ -79,37 +78,3 @@ func TestConvertDashboardFilePath(t *testing.T) { "file_path": "some/path", }) } - -func TestConvertDashboardEmbedCredentialsPassthrough(t *testing.T) { - for _, v := range []bool{true, false} { - t.Run(fmt.Sprintf("set to %v", v), func(t *testing.T) { - vin := dyn.V(map[string]dyn.Value{ - "embed_credentials": dyn.V(v), - }) - - ctx := context.Background() - out := schema.NewResources() - err := dashboardConverter{}.Convert(ctx, "my_dashboard", vin, out) - require.NoError(t, err) - - // Assert that the "embed_credentials" is set as configured. - assert.Subset(t, out.Dashboard["my_dashboard"], map[string]any{ - "embed_credentials": v, - }) - }) - } -} - -func TestConvertDashboardEmbedCredentialsDefault(t *testing.T) { - vin := dyn.V(map[string]dyn.Value{}) - - ctx := context.Background() - out := schema.NewResources() - err := dashboardConverter{}.Convert(ctx, "my_dashboard", vin, out) - require.NoError(t, err) - - // Assert that the "embed_credentials" is set to false (by default). - assert.Subset(t, out.Dashboard["my_dashboard"], map[string]any{ - "embed_credentials": false, - }) -}