Terraform: Terraform state rm - deletes everything

Created on 2 Oct 2017  ยท  5Comments  ยท  Source: hashicorp/terraform

Terraform Version

0.9.11

Expected Behavior

I wouldn't have imagined that terraform state rm without arguments would delete all of the resources in the terraform.tfstate file. I think this should be treated as an erroneous command by the user.

Actual Behavior

TF removed all of the resource in the terraform.tfstate file.
If remote state is configured, it'll also sync the now bare tfstate up to the remote location.

Steps to Reproduce

terraform state rm

Most helpful comment

@alwaysastudent:
terraform state rm "" as per this comment

All 5 comments

Thanks for filing the issue.

This is fixed in current releases by #15479.

How to remove all ?

@alwaysastudent:
terraform state rm "" as per this comment

@padamczewski
Unfortunately when I run terraform state rm "", I got the following error:

Error: Variable name required

  on  line 1:
  (source code not available)

Must begin with a variable name.

I'm on terraform 0.12.6 by the way.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ketzacoatl picture ketzacoatl  ยท  3Comments

zeninfinity picture zeninfinity  ยท  3Comments

franklinwise picture franklinwise  ยท  3Comments

darron picture darron  ยท  3Comments

thebenwaters picture thebenwaters  ยท  3Comments