Terraform : Destroy specific resource

Опубликовано: 18 Апрель 2026
на канале: Pachehra Talks
12,727
126

https://pachehra.blogspot.com/
In this video we learned how to destroy the specific resources :
$ terraform state list
$ terraform destroy -target RESOURCE_TYPE.NAME
$ terraform destroy -target RESOURCE_TYPE.NAME -target RESOURCE_TYPE2.NAME
$ terraform state list

** For multiple resources ***
$ terraform state list
$ terraform destroy -target=RESOURCE_TYPE.NAME -target=RESOURCE_TYPE2.NAME
$ terraform state list
1
Remove a Resource
$ terraform state rm module.foo.packet_device.worker[0]

Remove a Module
$ terraform state rm module.foo
1
2
3
4
5
Remove a Resource
$ terraform state rm module.foo.packet_device.worker[0]

Remove a Module
$ terraform state rm module.foo

   • Terraform with Azure : Count , length & list  
   • Terraform with Azure : Workspaces  
   • Terraform with Azure : Variables & Interpo...  
   • Terraform with Azure  Part-1  
   • Video  
   • Video  
   • AZ-300 Introductory Video  
   • AZ-300 Configure Diagnostics settings on R...  
   • AZ-300 Create Action Groups  
   • AZ-300 Alerts and baseline resources  

My name is Arun Pachehra and i am an IT Professional & a fitness enthusiast. Its been more than 12 years working with various technologies and now i am planning to share with you all. As per plan i am going to publish the entire Az 300 series first and if things would go as planned then a lot of stuff would come your way including Q&A , Production issues and various interesting stuff.