Search code examples
azure-storage-accountazure-rm

Azure terraform error when an existing resource is removed


We have created storage account in Azure environment using terraform script. Terraform plan and apply ran successfully. The resource was created in The same module I copy pasted it and created second storage account. That also was created successfully. The changes were pushed to main branch. Now when third storage account was created the same way, the change was pushed to main along with another change where web app was created. main branch terraform apply broke with the below error

enter image description here

The snippet of the code used to create the storage account is as given below enter image description here

The above error is repeated even when I removed the code for 3rd storage account. Its like I have to remove the reference of Container from 3rd storage account. I cannot remove container as a whole as it will affect the other two storage account I have created.

Please share your valuable inputs on this. I am stuck with this issue for whole day.


Solution

  • I am able to fix it. For storage account, we have to enable the storage service to subnet end point. Next, we have add A record to DNS for whitelisting. This is how we fixed this issue