Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error destroying resource that has already been deleted. #5876

Closed
clstokes opened this issue Mar 26, 2016 · 4 comments · Fixed by #5878
Closed

Error destroying resource that has already been deleted. #5876

clstokes opened this issue Mar 26, 2016 · 4 comments · Fixed by #5878

Comments

@clstokes
Copy link
Contributor

If an azurerm_storage_account resource has already been removed, Terraform is unable to proceed with a destroy due to a 404 error.

Steps to Reproduce
  1. Perform terraform apply with configuration below.
  2. Delete the storage account from the Azure portal.
  3. Run a terraform destroy
Example Config
resource "azurerm_storage_account" "test" {
  name                = "teststorageaccount2016"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "westus"
  account_type        = "Standard_LRS"

  tags {
    environment = "staging"
  }
}
Error log
terraform $ terraform destroy
Do you really want to destroy?
  Terraform will delete all your managed infrastructure.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

azurerm_resource_group.test: Refreshing state... (ID: /subscriptions/XYZ/resourceGroups/acctestrg)
azurerm_storage_account.test: Refreshing state... (ID: /subscriptions/XYZ/resourceGroups/acctestrg/providers/Microsoft.Storage/storageAccounts/hashicorpaccsa)
azurerm_virtual_network.test: Refreshing state... (ID: /subscriptions/XYZ/resourceGroups/acctestrg/providers/Microsoft.Network/virtualNetworks/acctvn)
azurerm_subnet.test: Refreshing state... (ID: /subscriptions/XYZ/resourceGroups/acctestrg/providers/Microsoft.Network/virtualNetworks/acctvn/subnets/acctsub)
azurerm_network_interface.test: Refreshing state... (ID: /subscriptions/XYZ/resourceGroups/acctestrg/providers/Microsoft.Network/networkInterfaces/acctni)
Error refreshing state: 1 error(s) occurred:

* azurerm_storage_account.test: Error reading the state of AzureRM Storage Account "hashicorpaccsa": autorest:DoErrorUnlessStatusCode 404 GET https://management.azure.com/subscriptions/XYZ/resourceGroups/acctestrg/providers/Microsoft.Storage/storageAccounts/hashicorpaccsa?api-version=2015-06-15 failed with 404 Not Found
terraform $
@clstokes
Copy link
Contributor Author

Similar to #3990 - Terraform destroy does not handle 404 on Google Compute Instance.

@stack72
Copy link
Contributor

stack72 commented Mar 27, 2016

Hi @clstokes

Am just preparing a fix for this right now :) good find on this

P.

@jen20
Copy link
Contributor

jen20 commented Mar 28, 2016

@clstokes This fix is now on master.

@ghost
Copy link

ghost commented Apr 27, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants