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 mv not creating backups #27908

Closed
mattk-ce opened this issue Feb 24, 2021 · 2 comments · Fixed by #29892
Closed

terraform state mv not creating backups #27908

mattk-ce opened this issue Feb 24, 2021 · 2 comments · Fixed by #29892
Assignees
Labels
bug confirmed a Terraform Core team member has reproduced this issue documentation explained a Terraform Core team member has described the root cause of this issue in code windows

Comments

@mattk-ce
Copy link

mattk-ce commented Feb 24, 2021

Terraform Version

0.14.6 - WINDOWS

Expected Behavior

backup file should be created

Actual Behavior

no backup file is created

Steps to Reproduce

  1. on windows
  2. using s3 remote state - might not be relevant, but is my current configuration
  3. terraform state mv -backup="test.backup" -state-out="test/terraform.tfstate" aws_iam_role.test aws_iam_role.test
    OR
    terraform state mv -state-out="test/terraform.tfstate" aws_iam_role.test aws_iam_role.test

Additional Context

Using an s3 backend (might not be relevant, but is my current configuration). When specifying a -backup, no backup file is created when executing a state mv. When not specifying -backup, no backup file is created when executing a state mv

@mattk-ce mattk-ce added bug new new issue not yet triaged labels Feb 24, 2021
@alisdair alisdair added confirmed a Terraform Core team member has reproduced this issue documentation and removed new new issue not yet triaged labels Feb 25, 2021
@alisdair
Copy link
Contributor

Hi @mattk-ce, thanks for reporting this.

The remote state storage backends do not support local backups (including the -backup CLI flag), to avoid accidentally exfiltrating sensitive state to a local filesystem. For more on this, see #16464, where the change was made. We recommend using bucket versioning as the S3 backup strategy.

That said, Terraform could be clearer about this. I think we might be able to find somewhere in the docs to clarify this exception, and perhaps we can render a diagnostic warning or error when using -backup with a remote state storage backend.

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug confirmed a Terraform Core team member has reproduced this issue documentation explained a Terraform Core team member has described the root cause of this issue in code windows
Projects
None yet
4 participants