databricks-cli/bundle/deploy/terraform
Pieter Noordhuis 6187803007
Correctly overwrite local state if remote state is newer (#1008)
## Changes

A bug in the code that pulls the remote state could cause the local
state to be empty instead of a copy of the remote state. This happened
only if the local state was present and stale when compared to the
remote version.

We correctly checked for the state serial to see if the local state had
to be replaced but didn't seek back on the remote state before writing
it out. Because the staleness check would read the remote state in full,
copying from the same reader would immediately yield an EOF.

## Tests

* Unit tests for state pull and push mutators that rely on a mocked
filer.
* An integration test that deploys the same bundle from multiple paths,
triggering the staleness logic.

Both failed prior to the fix and now pass.
2023-11-24 11:15:46 +00:00
..
apply.go Make bundle deploy work if no resources are defined (#767) 2023-09-13 22:50:37 +00:00
convert.go Fix metadata computation for empty bundle (#939) 2023-11-02 11:00:30 +00:00
convert_test.go Support Unity Catalog Registered Models in bundles (#846) 2023-10-16 15:32:49 +00:00
destroy.go Use custom prompter for bundle template inputs (#663) 2023-08-15 14:50:20 +00:00
dir.go Consolidate environment variable interaction (#747) 2023-09-11 08:18:43 +00:00
filer.go Correctly overwrite local state if remote state is newer (#1008) 2023-11-24 11:15:46 +00:00
init.go Pass `USERPROFILE` environment variable to Terraform (#1001) 2023-11-22 09:16:28 +00:00
init_test.go Pass `USERPROFILE` environment variable to Terraform (#1001) 2023-11-22 09:16:28 +00:00
interpolate.go Support Unity Catalog Registered Models in bundles (#846) 2023-10-16 15:32:49 +00:00
load.go Fix metadata computation for empty bundle (#939) 2023-11-02 11:00:30 +00:00
load_test.go Fix metadata computation for empty bundle (#939) 2023-11-02 11:00:30 +00:00
pkg.go Add mutators to pull and push Terraform state (#288) 2023-03-30 12:01:09 +02:00
plan.go Consolidate environment variable interaction (#747) 2023-09-11 08:18:43 +00:00
state_pull.go Correctly overwrite local state if remote state is newer (#1008) 2023-11-24 11:15:46 +00:00
state_pull_test.go Correctly overwrite local state if remote state is newer (#1008) 2023-11-24 11:15:46 +00:00
state_push.go Correctly overwrite local state if remote state is newer (#1008) 2023-11-24 11:15:46 +00:00
state_push_test.go Correctly overwrite local state if remote state is newer (#1008) 2023-11-24 11:15:46 +00:00
state_test.go Correctly overwrite local state if remote state is newer (#1008) 2023-11-24 11:15:46 +00:00
util.go Do not truncate local state file when pulling remote changes (#382) 2023-05-16 17:02:33 +02:00
util_test.go Correctly overwrite local state if remote state is newer (#1008) 2023-11-24 11:15:46 +00:00
write.go Make bundle deploy work if no resources are defined (#767) 2023-09-13 22:50:37 +00:00