Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: Fix state migration remote version check #27545

Merged

Conversation

alisdair
Copy link
Contributor

Previously the state migration process was using the fallback strict error check when migrating to or from a Terraform Cloud workspace. This resulted in an error when running init if the local and remote Terraform versions did not exactly match.

This was excessively strict. When migrating from a remote Terraform Cloud workspace to local state, there is no need for a version check at all, as we cannot break the Terraform Cloud workspace. When migrating to Terraform Cloud, we should use the more forgiving check, rather than the strict equality.

This commit fixes both of these cases accordingly, and allows migrating state to and from Terraform Cloud remote workspaces without errors.

Fixes #27543

Previously the state migration process was using the fallback strict
error check when migrating to or from a Terraform Cloud workspace. This
resulted in an error when running init if the local and remote Terraform
versions did not exactly match.

This was excessively strict. When migrating from a remote Terraform
Cloud workspace to local state, there is no need for a version check at
all, as we cannot break the Terraform Cloud workspace. When migrating
to Terraform Cloud, we should use the more forgiving check, rather than
the strict equality.

This commit fixes both of these cases accordingly, and allows migrating
state to and from Terraform Cloud remote workspaces without errors.
@alisdair alisdair added cli 0.14-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged labels Jan 19, 2021
@alisdair alisdair requested a review from a team January 19, 2021 16:50
@alisdair alisdair self-assigned this Jan 19, 2021
@codecov
Copy link

codecov bot commented Jan 19, 2021

Codecov Report

Merging #27545 (212a97c) into master (1c7c53a) will decrease coverage by 0.01%.
The diff coverage is 50.00%.

Impacted Files Coverage Δ
command/meta_backend_migrate.go 56.88% <50.00%> (-0.13%) ⬇️
terraform/node_resource_plan.go 96.11% <0.00%> (-1.95%) ⬇️
backend/remote/backend_common.go 50.53% <0.00%> (-0.72%) ⬇️
terraform/evaluate.go 52.47% <0.00%> (-0.42%) ⬇️
dag/marshal.go 63.49% <0.00%> (+1.58%) ⬆️

@alisdair alisdair merged commit a7d50d3 into master Jan 20, 2021
@alisdair alisdair deleted the alisdair/remote-backend-version-check-state-migration branch January 20, 2021 16:08
@ghost
Copy link

ghost commented Feb 20, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0.14-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged cli
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remote Version Check prevents changing backend to “local” when Terraform point-releases mismatch
2 participants