databricks-cli/bundle/deploy/terraform
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
..
tfdyn Return `dyn.InvalidValue` instead of `dyn.NilValue` when errors happen (#1514) 2024-06-21 14:22:42 +00:00
apply.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
check_running_resources.go Don't merge-in remote resources during depolyments (#1432) 2024-05-15 12:41:44 +00:00
check_running_resources_test.go Don't merge-in remote resources during depolyments (#1432) 2024-05-15 12:41:44 +00:00
convert.go Add support for Lakehouse monitoring in bundles (#1307) 2024-05-31 09:42:25 +00:00
convert_test.go Properly deal with nil values in `convert.FromTyped` (#1511) 2024-06-21 13:43:21 +00:00
destroy.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
dir.go Consolidate environment variable interaction (#747) 2023-09-11 08:18:43 +00:00
import.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
init.go Attribute Terraform API requests the CLI (#1598) 2024-07-18 09:38:09 +00:00
init_test.go Attribute Terraform API requests the CLI (#1598) 2024-07-18 09:38:09 +00:00
interpolate.go Add support for Lakehouse monitoring in bundles (#1307) 2024-05-31 09:42:25 +00:00
interpolate_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
load.go Don't fail while parsing outdated terraform state (#1404) 2024-05-01 08:22:35 +00:00
load_test.go Move path field to bundle type (#1316) 2024-03-27 09:03:24 +00:00
pkg.go Followup improvements to the Docker setup script (#1369) 2024-04-18 20:52:11 +00:00
pkg_test.go Followup improvements to the Docker setup script (#1369) 2024-04-18 20:52:11 +00:00
plan.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
state_pull.go Use local Terraform state only when lineage match (#1588) 2024-07-18 09:47:59 +00:00
state_pull_test.go Use local Terraform state only when lineage match (#1588) 2024-07-18 09:47:59 +00:00
state_push.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
state_push_test.go Use local Terraform state only when lineage match (#1588) 2024-07-18 09:47:59 +00:00
state_test.go Use local Terraform state only when lineage match (#1588) 2024-07-18 09:47:59 +00:00
unbind.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
util.go Use local Terraform state only when lineage match (#1588) 2024-07-18 09:47:59 +00:00
util_test.go Use local Terraform state only when lineage match (#1588) 2024-07-18 09:47:59 +00:00
write.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00