From the course: Advanced Terraform

Unlock the full course today

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

Destroying resources

Destroying resources - Terraform Tutorial

From the course: Advanced Terraform

Destroying resources

- Before we continue, we should clean up after ourselves. In the terminal, execute the following command. Terraform Destroy. Hit enter. This command does what you'd expect, destroy all the resources defined by the configuration. The destroy command generates a special plan which is the opposite of the current state. This plan contains a removal action for all resources listed in the state. Terraform displays the changes it will make and asks us to confirm explicitly by typing in yes. Go ahead and do that now, and enter. This will remove all the resources created by this configuration. Just as Terraform knows the order in which to create, it can use the reverse order to destroy our deployed resources. This is by definition, a destructive process. So proceed carefully when working with Terraform. Removal of resources from higher-level environments, especially production, should be handled with extreme care. The…

Contents