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 rebuild it better in accordance with new specifications.
-
We provide an infrastructure that is called 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 an 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 are going to provide an infrastructure in Azure that...