For some unknown reason, the removed items remain in the state file after I remove from the .tfstate file.
CASE:
- downloaded my state file(
my_statefile.tfstate) from cloud_bucket where it's stored - In the application cloned repo, I placed the file in the folder that contains the items I want to remove from the state
- ran
terraform init - ran
terraform state list -state=my_statefile.tfstate
output:
item 1
item 2
item 3
- ran
terraform state rm -state=my_statefile.tfstate item1 - ran
terraform state list -state=my_statefile.tfstate
output:
item 2
item 3
However when I inspect the file with cat my_statefile.tfstate
the item 1 is still there..
I even created a empty file called empty.tfstate and tried the flow described above and got the same results which is kind of odd.
Does anyone have any clues on what can be happening here?
state listoutput. Wherever that state is stored it got updated. If the file in the bucket is not changing then it is not the actual state file, simple as that.