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 state rm ignores -state=... option #15359

Closed
dlamotte opened this issue Jun 21, 2017 · 1 comment · Fixed by #15388
Closed

terraform state rm ignores -state=... option #15359

dlamotte opened this issue Jun 21, 2017 · 1 comment · Fixed by #15388
Assignees

Comments

@dlamotte
Copy link
Contributor

Terraform Version

Terraform v0.9.8

Terraform Configuration Files

terraform {
  backend "s3" {
    bucket     = "mybucket"
    encrypt    = true
    key        = "prod.tfstate"
    lock_table = "terraform"
    region     = "us-west-1"
  }
}

provider "aws" {
    region = "us-west-1"
}

Debug Output

None

Panic Output

None

Expected Behavior

State within the provided -state=... file should have been updated.

Actual Behavior

State provided in the remote s3 backend terraform block above was updated and the local -state=... provided with the option was backed up but not the state in the remote bucket.

Steps to Reproduce

  1. Write above terraform block with remote backend s3 state to a terraform file.
  2. terraform state pull > dev.tfstate
  3. terraform state rm -state=./dev.tfstate aws_iam_group.mygroup

Data-loss (IMO): dev.tfstate is backed up to dev.tfstate.backup.* BUT remote state in the bucket is updated(!!!). We have s3 bucket object versioning on, so we just reverted without issue, but its not clear whether this is a backend issue or something higher in which it could be very scary very fast.

Important Factoids

Standard AWS + S3

References

Nope

@ghost
Copy link

ghost commented Apr 8, 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 and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants