From the course: Hashicorp Certified Terraform Associate (003) Cert Prep

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Use terraform destroy

Use terraform destroy

- [Instructor] Lets understand how we can use terraform destroy command to manage our infrastructure. Over here in AWS, this is the EC2 instance that just got provisioned in us-east-1a. So using destroy command in Terraform is a crucial part of Terraforms' workflow. Sometimes you need to tidy up and remove resources that are no longer needed in your infrastructure. So the destroy step helps with this cleanup. So using terraform destroy command we help with the cleanup. So it is like decluttering your workspace to keep things efficient. But using destroy, you help to prevent unnecessary resources from piling up and using extra cloud services. For instance, if I leave this EC2 instance I just created, it'll just be there and the bills will be piling up for me. So since I don't need it anymore, I just created this for demo purposes, I can go ahead to destroy it thus. When we run this command, Terraform will responsibly remove the resource, making sure it doesn't later around. In the end,…

Contents