mirror of https://github.com/databricks/cli.git
Remove embed_credentials default from tfdyn
This commit is contained in:
parent
b63e94366a
commit
b54c10b832
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue