databricks-cli/bundle/deploy
shreyas-goenka 5b65358146
Use local Terraform state only when lineage match (#1588)
## Changes
DABs deployments should be isolated if `root_path` and workspace host
are different. This PR fixes a bug where local terraform state gets
piggybacked if the same cwd is used to deploy two isolated deployments
for the same bundle target. This can happen if:
1. A user switches to a different identity on the same machine. 
2. The workspace host URL the bundle/target points to is changed.
3. A user changes the `root_path` while doing bundle development.

To solve this problem we rely on the lineage field available in the
terraform state, which is a uuid identifying unique terraform
deployments. There's a 1:1 mapping between a terraform deployment and a
bundle deployment.

For more details on how lineage works in terraform, see:
https://developer.hashicorp.com/terraform/language/state/backends#manual-state-pull-push

## Tests
Manually verified that changing the identity no longer results in the
incorrect terraform state being used. Also, new unit tests are added.
2024-07-18 09:47:59 +00:00
..
files Use `vfs.Path` for filesystem interaction (#1554) 2024-07-03 10:13:22 +00:00
lock Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
metadata Annotate DLT pipelines when deployed using DABs (#1410) 2024-05-01 08:37:03 +00:00
terraform Use local Terraform state only when lineage match (#1588) 2024-07-18 09:47:59 +00:00
filer.go Added deployment state for bundles (#1267) 2024-03-18 14:41:58 +00:00
state.go Add UUID to uniquely identify a deployment state (#1595) 2024-07-16 10:01:58 +00:00
state_pull.go Use `vfs.Path` for filesystem interaction (#1554) 2024-07-03 10:13:22 +00:00
state_pull_test.go Use `vfs.Path` for filesystem interaction (#1554) 2024-07-03 10:13:22 +00:00
state_push.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
state_push_test.go Move path field to bundle type (#1316) 2024-03-27 09:03:24 +00:00
state_test.go Use `vfs.Path` for filesystem interaction (#1554) 2024-07-03 10:13:22 +00:00
state_update.go Add UUID to uniquely identify a deployment state (#1595) 2024-07-16 10:01:58 +00:00
state_update_test.go Add UUID to uniquely identify a deployment state (#1595) 2024-07-16 10:01:58 +00:00