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

terraform taint Does Not Check Terraform Version #23049

Closed
jjorissen52 opened this issue Oct 10, 2019 · 3 comments · Fixed by #26345
Closed

terraform taint Does Not Check Terraform Version #23049

jjorissen52 opened this issue Oct 10, 2019 · 3 comments · Fixed by #26345
Labels
bug cli v0.12 Issues (primarily bugs) reported against v0.12 releases

Comments

@jjorissen52
Copy link

jjorissen52 commented Oct 10, 2019

Terraform Version

Terraform v0.12.8
+ provider.google v2.16.0
+ provider.null v2.1.2
+ provider.random v2.2.1
# and
Terraform v0.12.10
+ provider.google v2.16.0
+ provider.null v2.1.2
+ provider.random v2.2.1

Terraform Configuration Files

###################
# State Management #
###################

# manage state remotely with history in case something goes horribly wrong
terraform {                                                                                                                                                                                                           
  required_version = "0.12.8"
  backend "remote" {
      hostname = "app.terraform.io"
      organization = "..."
      workspaces {
        prefix = "..."
      }
  }
}

Expected Behavior

When I run terraform taint with a version of terrafrom incompatible with my remote state settings, I should get an error like the below:

Error: Unsupported Terraform Core version

  on main.tf line 7, in terraform:
   7:   required_version = "0.12.8"

This configuration does not support Terraform version 0.12.10. To proceed,
either choose another supported Terraform version or update this version
constraint. Version constraints are normally set for good reason, so updating
the constraint may lead to other errors or unexpected behavior.

Actual Behavior

The terraform version was ratcheted up to v0.12.10 in Terraform Cloud (with no way to revert as far I know).

Error: Error loading state: state snapshot was created by Terraform v0.12.10, which is newer than current v0.12.8; upgrade to Terraform v0.12.10 or greater to work with this state

Steps to Reproduce

Run the below on a project that specifies v0.12.8 using terraform v0.12.10
terraform0.12.10 taint $resource0.12.8

Additional Context

Terraform Cloud is being used to manage state remotely, but everything is being executed locally.

@hashibot hashibot added bug cli v0.12 Issues (primarily bugs) reported against v0.12 releases labels Oct 10, 2019
@pkolyvas
Copy link
Contributor

@jjorissen52 Thank you for taking the time to describe the issue so clearly.

We have been tracking this and similar issues where we have failed to make clear when a particular operation is run locally on a workspace / configuration which has the Terraform Cloud remote back end enabled.

terraform taint is one such operation which occurs locally and can, as you've discovered, upgrade your state file, rendering it incompatible with the currently selected version of Terraform in your remote workspace.

Currently we are in the planning phase of how we intend to take a stab at this, but it is something we are actively thinking about.

@alisdair
Copy link
Contributor

alisdair commented Sep 24, 2020

I think this should be fixed by #26345.

@ghost
Copy link

ghost commented Oct 25, 2020

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 Oct 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug cli v0.12 Issues (primarily bugs) reported against v0.12 releases
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants