terraform
terraform copied to clipboard
terraform state rm: option passed in wrong order results in "Variable name required" error
Trying to follow the documentation for removing some resources from state file. I'm using eks module and trying to remove it by running terraform state rm module.eks --dry-run. I'm getting the following error message:
Error: Variable name required
on line 1:
(source code not available)
Must begin with a variable name.
Also tried terraform state rm "" --dry-run which returns the same result.
Using Terraform v0.14.8
Hi @mikaint ,
The output here can be a bit confusing. -dry-run is a flag for the rm command, hence it must follow that command before any arguments. Passing it at the end of the command is passing that string as an argument, and it is not a valid resource address. The command you are looking for here is
terraform state rm -dry-run module.eks
I think what we need to do here is fix where the erroneous --dry-run is being parsed that is generating the Variable name required error output.
Thanks!