Repository navigation
Commit 0f52d4c
Migrate terraform state to direct before deploy (#6749)
## Changes
Run the terraform→direct state migration *before* plan/deploy (after the
build, so `${artifacts.*}` and library paths are resolved) instead of
after a terraform deploy, so the deploy itself runs on the direct
engine. The migration:
- seeds id-composing fields from the deployed terraform state and
compares them normalization-aware (identifier case, trailing slash), so
a backend-normalized id converges while a genuine change surfaces as a
recreate/rename (`reconcileIDFields`);
- is prepared in memory and reversible; a deploy commits it — pushing
the direct state and retiring the terraform state — only once the deploy
is approved, before applying its own changes. A declined deploy drops it
and stays on terraform, so a refused recreate changes nothing (a genuine
recreate is gated by `--auto-approve` like any other);
- falls back to terraform for that run (with a warning) if a pre-commit
step fails — parse, convert, or plan check — so a failed migration never
blocks a deploy that would otherwise succeed;
- tags the user agent with the engine the run actually uses.
`engine: terraform` still opts out. Destroy commits the migration as
part of its teardown and then removes all local state, so no terraform
state or backup is left behind. The terraform-engine removal is stacked
on top of this PR.
## Tests
Acceptance tests under `acceptance/bundle/migrate/` cover rename,
cross-catalog move, normalization-converge,
recreate-refused-without-`--auto-approve` (then applied with it),
push/plan/backup failure handling, and clean teardown on destroy (no
leftover local or remote state), across schemas, volumes, registered
models and pipelines. The rename/converge/catalog-move tests also run
against a real workspace (`Cloud = true`, verified on aws-cli); the
storage/external-location cases run on the testserver.
This pull request and its description were written by Isaac.
---------
Co-authored-by: Isaac <no-reply@databricks.com>1 parent f5baa1d commit 0f52d4c
242 files changed
Lines changed: 2486 additions & 693 deletions
File tree
- .nextchanges/bundles
- acceptance/bundle
- deploy/snapshot-comparison
- migrate
- auto-migrate-direct-only
- auto-migrate-empty-tfstate
- auto-migrate-plan-failure
- auto-migrate-push-failure
- auto
- apply-failure
- artifacts
- dist
- clean
- default
- delete-all
- delete
- destroy
- direct-only-envvar
- direct-only
- dms-migration
- empty-plan-missing
- empty-tfstate
- envvar
- pipeline-storage-change
- plan-failure
- plan-missing
- push-failure
- registered-model-catalog-change
- registered-model-rename
- run-no-commit
- schema-catalog-change
- schema-name-normalized
- schema-rename
- schema-storage-change
- schema-storage-normalized
- tfbackup-failure
- volume-name-normalized
- volume-rename
- volume-type-change
- command
- added-direct-only
- added
- basic
- dashboards
- default-python
- engine-config-direct
- engine-config-terraform
- grants
- permissions
- profile_arg
- removed
- runas
- var_arg
- state/state_present
- bundle
- direct/dstate
- metrics
- migrate
- phases
- statemgmt
- cmd/bundle/utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
67 | 69 | | |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
0 commit comments