Enabling optional Azure features
One of the interesting points of the azurerm
provider is the possibility to activate or deactivate some optional Azure features directly via the provider configuration.
To illustrate this provider feature, we will see in this recipe how to disable the deletion of an Azure resource group if this resource group contains resources.
Let’s get started!
Getting ready
To complete this recipe, no requirements are needed.
We consider that the Terraform configuration used in this recipe is already written and it provisions a resource group. Inside this resource group, we create an Azure Storage Account manually (via the portal, Azure CLI, or another Terraform configuration).
The source code of this Terraform configuration is available here: https://github.com/PacktPublishing/Terraform-Cookbook-Second-Edition/blob/main/CHAP08/feature/main.tf.
By default, without any other configuration, If we execute the command terraform destroy...