Skip to content

bundle: keep pending secret scope rename when migrating Terraform state - #6971

Draft
denik wants to merge 6 commits into
mainfrom
denik/tf-migrate-secret-scope-rename
Draft

denik wants to merge 6 commits into
mainfrom
denik/tf-migrate-secret-scope-rename

Conversation

@denik

@denik denik commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

When Terraform state is migrated to the direct engine, a secret scope renamed in config since the last Terraform deploy kept its old name: the id-field reconciler looked up the direct state field scope in the Terraform attributes, where it is called name, and silently skipped it. The migrated state then recorded the new name as deployed and the rename was never applied. The reconciler now maps that field explicitly, so the rename is surfaced as a recreate. Adds bundle/migrate/auto/secret-scope-rename.

This pull request and its description were written by Isaac.

@github-actions github-actions Bot added the DABs DABs related issues label Oct 7, 2026
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 6445c48

Run: 38239386841

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 276 17 5:59
✅​ aws-windows-latest-4core-16gb 278 15 3:23
✅​ azure linux-2core-8gb 275 17 6:36
✅​ azure-windows-latest-4core-16gb 277 15 3:26
✅​ gcp linux-2core-8gb 276 17 5:30
✅​ gcp-windows-latest-4core-16gb 278 15 3:12
Top 5 slowest tests (at least 2 minutes):
duration env testname
3:58 gcp linux-2core-8gb TestAccept
3:55 azure linux-2core-8gb TestAccept
3:55 aws linux-2core-8gb TestAccept
2:38 aws-windows-latest-4core-16gb TestAccept
2:19 azure-windows-latest-4core-16gb TestAccept

denik and others added 6 commits October 12, 2026 12:52
When migrating Terraform state to the direct engine, reconcileIDFields looks up
ID field values from the Terraform state to detect user-initiated renames/recreates
not yet deployed. For secret scopes, the direct state field is `scope` but
Terraform stores it as `name`. The lookup was using the unmapped DABs field name
and failing silently, so pending renames were treated as normalization instead
of being flagged for recreation.

Add mapping: secret_scopes.scope <-> Terraform secret_scopes.name

Fix: add the field rename mapping in terraform_dabs_map so LookupTFField can
find the correct Terraform attribute name. Also add acceptance test to verify
the fix works.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
When migrating Terraform state to the direct engine, reconcileIDFields looks up
ID field values from the Terraform state to detect user-initiated renames/recreates
not yet deployed. For secret scopes, the direct state field is `scope` but
Terraform stores it as `name`. The lookup was using the DABs field name and
failing silently, so pending renames were treated as normalization instead of
being flagged for recreation.

Fix: add a fallback lookup in reconcileIDFields specifically for secret_scopes
that translates the direct state field name to the Terraform attribute name.
This keeps the fix localized to the migration context and does not affect
field name translation for references or other parts of the system.

Co-authored-by: Isaac <no-reply@databricks.com>
Look up the Terraform attribute through a small state-field table before the
lookup rather than retrying with "name" after a failure, so there is one code
path and the mapping is visible.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik force-pushed the denik/tf-migrate-secret-scope-rename branch from 5d84be9 to 6445c48 Compare October 12, 2026 10:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants