Skip to content

Commit 9434908

Browse files
committed
Apply SecretScopeFixups in upload_state_for_yaml_sync.go
Add SecretScopeFixups(EngineDirect) before reading b.Config.Value() so the config includes .permissions entries for secret scopes. Without this, CalculatePlan sees .permissions in state but not in config and produces incorrect plan entries during YAML sync conversion. Co-authored-by: Isaac
1 parent 6def5f4 commit 9434908

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bundle/statemgmt/upload_state_for_yaml_sync.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/databricks/cli/bundle"
1212
"github.com/databricks/cli/bundle/config"
1313
"github.com/databricks/cli/bundle/config/engine"
14+
"github.com/databricks/cli/bundle/config/mutator/resourcemutator"
1415
"github.com/databricks/cli/bundle/deploy"
1516
"github.com/databricks/cli/bundle/deploy/terraform"
1617
"github.com/databricks/cli/bundle/deployplan"
@@ -22,6 +23,7 @@ import (
2223
"github.com/databricks/cli/libs/dyn/dynvar"
2324
"github.com/databricks/cli/libs/filer"
2425
"github.com/databricks/cli/libs/log"
26+
"github.com/databricks/cli/libs/logdiag"
2527
"github.com/databricks/cli/libs/structs/structaccess"
2628
"github.com/databricks/cli/libs/structs/structpath"
2729
)
@@ -135,6 +137,14 @@ func (m *uploadStateForYamlSync) convertState(ctx context.Context, b *bundle.Bun
135137
},
136138
}
137139

140+
// Apply SecretScopeFixups so the config matches what the direct engine expects.
141+
// This adds MANAGE ACL for the current user to all secret scopes, ensuring
142+
// the migrated state and config agree on .permissions entries.
143+
bundle.ApplyContext(ctx, b, resourcemutator.SecretScopeFixups(engine.EngineDirect))
144+
if logdiag.HasError(ctx) {
145+
return diag.Errorf("failed to apply secret scope fixups")
146+
}
147+
138148
// Get the dynamic value from b.Config and reverse the interpolation
139149
// b.Config has been modified by terraform.Interpolate which converts bundle-style
140150
// references (${resources.pipelines.x.id}) to terraform-style (${databricks_pipeline.x.id})

0 commit comments

Comments
 (0)