terraform state - removing resources from a state file
Let's say we would like to remove state file from our terraform. So let's list it down here
terraform state list
null_resource.server["web1"]
null_resource.server["web2"]
Le'ts remove the web1 from the resource. In command prompt you need to run this command. It will be different on Powershell due to its how it interpretes quotes.
Command prompt
terraform state rm "null_resource.server[`"web1`"]"
Powershell
terraform state rm 'null_resource.server[\"web1\"]'
And you cans see the resources being removed.
Comments