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

Popular posts from this blog

gemini cli getting file not defined error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

vllm : Failed to infer device type