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

Fix terraform_remote_state backend version check #27197

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

alisdair
Copy link
Contributor

@alisdair alisdair commented Dec 8, 2020

The change recently introduced to ensure that remote backend users do not accidentally upgrade their state file (#26947) needs to be disabled for all read-only uses, including the builtin terraform_remote_state data source. Without doing this, the remote state data source fails to read state from remote backend sources which do not have an exactly matching Terraform version.

I don't see any reasonable way to add automated tests for this change. Here is an example of the manual verification I'm doing:

tf15

data "terraform_remote_state" "sfv" {
  backend = "remote"

  config = {
    workspaces = {
      name = "sfv"
    }
    organization = "alisdair-v2"
  }
}

output "foobar" {
  value = data.terraform_remote_state.sfv.outputs.foobar
}

If approved, I intend to backport this change to 0.14, 0.13, and 0.12.

Fixes #27200

The change recently introduced to ensure that remote backend users do
not accidentally upgrade their state file needs to be disabled for all
read-only uses, including the builtin terraform_remote_state data
source.
@alisdair alisdair added 0.14-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 0.13-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged labels Dec 8, 2020
@alisdair alisdair requested a review from a team December 8, 2020 19:27
@alisdair alisdair self-assigned this Dec 8, 2020
@codecov
Copy link

codecov bot commented Dec 8, 2020

Codecov Report

Merging #27197 (107dc0c) into master (93c36e6) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Impacted Files Coverage Δ
builtin/providers/terraform/data_source_state.go 87.42% <0.00%> (-1.12%) ⬇️
internal/providercache/dir.go 67.34% <0.00%> (-6.13%) ⬇️
terraform/node_resource_plan.go 96.11% <0.00%> (-1.95%) ⬇️
dag/marshal.go 61.90% <0.00%> (-1.59%) ⬇️
terraform/evaluate.go 52.89% <0.00%> (-0.42%) ⬇️

Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure I understand why "is the enhanced remote backend" is the right condition here, but the testing procedure you showed in the writeup makes sense to me and this seems to be an urgent-type fix so I'm approving this with the goal of understanding why this is the right answer later, after we've got the release done. 😀

@alisdair
Copy link
Contributor Author

alisdair commented Dec 8, 2020

I'm not really sure I understand why "is the enhanced remote backend" is the right condition here

If I understand what you mean here, this is because the change in #26947 was only implemented as a method on the remote backend type—other backends used for remote state don't have an equivalent method.

@ghost
Copy link

ghost commented Jan 8, 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 Jan 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0.13-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 0.14-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remote backend Terraform version validation does not work with Terraform Cloud local execution mode
2 participants