terraform-provider-azurerm: terraform plan hangs forever after trying to upgrade provider to 1.37.0
Terraform (and AzureRM Provider) Version
- terraform 0.12.10
- azurerm 1.37.0
Affected Resource(s)
Not sure what to include here apart from this (mentioned in the logs):
azurerm_storage_containerazurerm_storage_account
Terraform Configuration Files
resource "azurerm_storage_account" "terraforminfra" {
name = "${replace(var.domain, "-", "")}infra"
resource_group_name = azurerm_resource_group.main.name
location = var.region
account_tier = "Standard"
account_replication_type = "ZRS"
tags = {
environment = var.domain
}
}
resource "azurerm_storage_container" "terraform-state" {
name = var.terraform_storage_container_name
storage_account_name = azurerm_storage_account.terraforminfra.name
container_access_type = "private"
}
Debug Output
This just repeats forever
2019/11/26 13:46:35 [TRACE] dag/walk: vertex "provider.azurerm (close)" is waiting for "azurerm_storage_container.terraform-state"
2019/11/26 13:46:36 [TRACE] dag/walk: vertex "azurerm_storage_container.terraform-state" is waiting for "azurerm_storage_account.terraforminfra"
2019/11/26 13:46:36 [TRACE] dag/walk: vertex "output.storage_account_id" is waiting for "azurerm_storage_account.terraforminfra"
2019/11/26 13:46:36 [TRACE] dag/walk: vertex "root" is waiting for "provider.azurerm (close)"
2019/11/26 13:46:40 [TRACE] dag/walk: vertex "provider.azurerm (close)" is waiting for "azurerm_storage_container.terraform-state"
2019/11/26 13:46:41 [TRACE] dag/walk: vertex "azurerm_storage_container.terraform-state" is waiting for "azurerm_storage_account.terraforminfra"
2019/11/26 13:46:41 [TRACE] dag/walk: vertex "output.storage_account_id" is waiting for "azurerm_storage_account.terraforminfra"
2019/11/26 13:46:41 [TRACE] dag/walk: vertex "root" is waiting for "provider.azurerm (close)"
2019/11/26 13:46:45 [TRACE] dag/walk: vertex "provider.azurerm (close)" is waiting for "azurerm_storage_container.terraform-state"
2019/11/26 13:46:46 [TRACE] dag/walk: vertex "azurerm_storage_container.terraform-state" is waiting for "azurerm_storage_account.terraforminfra"
2019/11/26 13:46:46 [TRACE] dag/walk: vertex "output.storage_account_id" is waiting for "azurerm_storage_account.terraforminfra"
2019/11/26 13:46:46 [TRACE] dag/walk: vertex "root" is waiting for "provider.azurerm (close)"
2019/11/26 13:46:50 [TRACE] dag/walk: vertex "provider.azurerm (close)" is waiting for "azurerm_storage_container.terraform-state"
2019/11/26 13:46:51 [TRACE] dag/walk: vertex "output.storage_account_id" is waiting for "azurerm_storage_account.terraforminfra"
2019/11/26 13:46:51 [TRACE] dag/walk: vertex "azurerm_storage_container.terraform-state" is waiting for "azurerm_storage_account.terraforminfra"
2019/11/26 13:46:51 [TRACE] dag/walk: vertex "root" is waiting for "provider.azurerm (close)"
Expected Behavior
Terraform plan should work, upgrade provider, apply necessary changes, etc. Works fine with 1.36.0
Actual Behavior
At some point, terraform plan just hangs forever with the above output, had to enable trace logs to be able to see it
Steps to Reproduce
- Update provider to 1.37.0
- Run terraform plan
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 11
- Comments: 23 (14 by maintainers)
The delay is caused by this call https://github.com/terraform-providers/terraform-provider-azurerm/blob/6ed5554bad427aae8872c6ead28b53844b209aa5/azurerm/resource_arm_storage_account.go#L1164.
This eventually calls the code from
github.com/Azure/go-autorest/autorest v0.9.2, which was upgraded from 0.9.0 in 1.37.0 release:the delay is introduced in https://github.com/Azure/go-autorest/blob/master/autorest/sender.go
The debug output here is:
This will never be a successful call for storage accounts that do not have a queue.
This has been released in version 1.41.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:
If I understand this issue correctly, it’s supposed to be resolved by https://github.com/terraform-providers/terraform-provider-azurerm/pull/5316. Just as a note for everyone looking into this.
@tombuildsstuff could you please assess this one, as it kills all plans with storage accounts that do not have queues.
👋
From what I can tell this should be fixed in #5316 - since that’s been merged I’m going to close this issue for the moment; but if you’re still seeing this after upgrading to v1.41 (once that’s released) please let us know and we’ll take another look 😃
Thanks!
I seem to be having this issue (terraform just hangs when refreshing it’s state) with the 1.41 version of the azurerm provider using terraform version 0.12.19
Any ideas, as I’m pretty much blocked applying updates to our clusters?
I’m using remote state (azure storage account) and I can see terraform acquiring a state lock, refreshing all the resources and then it just hangs there…
I see the same behavior on storage_account resource, it actually manages to come out of this after some 20 minutes.
` $ TF_LOG=TRACE terraform plan --target module.tfe.module.data.azurerm_storage_account.this … 2019-11-27T09:02:29.498+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4: POST /subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Storage/storageAccounts/XXX/listKeys?%24expand=kerb&api-version=2019-04-01 HTTP/1.1 …
2019-11-27T09:02:29.648+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Storage/storageAccounts/XXX/listKeys?%24expand=kerb&api-version=2019-04-01: 2019-11-27T09:02:29.648+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4: HTTP/2.0 200 OK 2019-11-27T09:02:29.648+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4: {“keys”:[{“keyName”:“key1”,“value”:“XXX”,“permissions”:“FULL”},{“keyName”:“key2”,“value”:“XXX”,“permissions”:“FULL”}]}
… 2019/11/27 09:23:57 [TRACE] dag/walk: vertex “provider.azurerm.fxi_production1_services (close)” is waiting for “module.tfe.module.data.azurerm_storage_account.this” 2019/11/27 09:23:59 [TRACE] dag/walk: vertex “root” is waiting for “provider.azurerm.fxi_production1_services (close)” 2019/11/27 09:24:02 [TRACE] dag/walk: vertex “provider.azurerm.fxi_production1_services (close)” is waiting for “module.tfe.module.data.azurerm_storage_account.this” 2019/11/27 09:24:04 [TRACE] dag/walk: vertex “root” is waiting for “provider.azurerm.fxi_production1_services (close)” 2019/11/27 09:24:04 [TRACE] module.tfe.module.data: eval: *terraform.EvalWriteState 2019/11/27 09:24:04 [TRACE] EvalWriteState: recording 1 dependencies for module.tfe.module.data.azurerm_storage_account.this 2019/11/27 09:24:04 [TRACE] EvalWriteState: writing current state object for module.tfe.module.data.azurerm_storage_account.this 2019/11/27 09:24:04 [TRACE] [walkRefresh] Exiting eval tree: module.tfe.module.data.azurerm_storage_account.this 2019/11/27 09:24:04 [TRACE] vertex “module.tfe.module.data.azurerm_storage_account.this”: visit complete 2019/11/27 09:24:04 [TRACE] vertex “module.tfe.module.data.azurerm_storage_account.this”: dynamic subgraph completed successfully 2019/11/27 09:24:04 [TRACE] vertex “module.tfe.module.data.azurerm_storage_account.this”: visit complete `