Destroying infrastructure resources
As we have said many times in this book, IaC allows the rapid provisioning of infrastructure.
Another advantage of IaC is that it allows a quick build and the cleaning up of resources that have been provisioned.
Indeed, we may need to clean up an infrastructure for different reasons. Here are a few examples:
- We destroy an infrastructure with a view to rebuilding it better in accordance with new specifications.
- We provide an infrastructure on demand, which means it is temporary for a specific need (such as to test a new feature or a new branch of the application). And this infrastructure must be capable of being built and destroyed quickly and automatically.
- We want to remove unused infrastructure and, at the same time, no longer pay for it.
In this recipe, we will discuss how to destroy an infrastructure that has been provisioned with Terraform.
Getting ready
To get started, we will provide an infrastructure...