Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
When you use the various backends, such as azurerm backend, it creates a blob in a container in a storage account. When you remove the backend and re-run terraform init it will offer to pull the remote state local. However it does not delete the remote container/blob, and I cannot find a command or option to make it do this. The remote container/blob needs to be removed manually using other tools like Azure CLI. I'd like either re-init to offer to remove it (or just remove it), or a command or argument or similar to have terraform clean up after itself.
Terraform did not work the way I expected, hence this feature request.
When you use the various backends, such as azurerm backend, it creates a blob in a container in a storage account. When you remove the backend and re-run
terraform init
it will offer to pull the remote state local. However it does not delete the remote container/blob, and I cannot find a command or option to make it do this. The remote container/blob needs to be removed manually using other tools like Azure CLI. I'd like either re-init to offer to remove it (or just remove it), or a command or argument or similar to have terraform clean up after itself.Terraform did not work the way I expected, hence this feature request.
Terraform Version
Terraform v0.11.9
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Expected Behavior
Terraform should delete the blob it created
Actual Behavior
blob "key" under container "container" under storage account "storage" still exists.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform init
terraform init
References
Re-reading the documentation it doesn't state it will delete the backend. https://www.terraform.io/docs/backends/config.html#unconfiguring-a-backend
Use-cases
User wants to remove a backend, terraform cleans up after itself rather than leaving behind containers and accounts, etc.
Attempted Solutions
Read the docs,
--help
, googled around, logged a bug against azurerm provider, https://github.com/terraform-providers/terraform-provider-azurerm/issues/979, told to open one in core as that's the code responsible for the current behaviour.Proposal
I'd like either re-init to offer to remove it (or just remove it), or a command or argument or similar to have terraform clean up after itself.
References
https://github.com/terraform-providers/terraform-provider-azurerm/issues/979