How to Delete all Resources Except One in Terraform

0 min read 64 words

If you need to delete all resources created by Terraform, except for a single, specific one, then you can do the following:

Step 1 – Get the current state list

terraform state list

Step 2 – Remove the exception resource

Remove the specific resource that you don’t want Terraform to track anymore.

terraform state rm <resource_to_be_removed>

Step 3 – Destroy the resources

terraform destroy
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags

Recent Posts