I had a troublesome few hours upgrading the AzureRM Terraform provider recently. It refused to plan or apply one specifc storage account container. To really confuse things, it was only doing this in two environments out of three, that have this particular container. I removed the object from state and tried to import it again, still the same error. I forgot to write the error down, it was something like invalid domain. I used the console to view the objects details. I was almost all the way through completing a bug report in Github against the provider when I finally saw something slightly odd between the working and a non working environment. Can you see it?
It looks lke the the two broken environments were missing a subdomain from the ID attribute. I presume that when these two environments were built, Azure used a different URL nomenclature and the latest providers now validate the domain is correct! Thankfully, the fix was easy. Remove the object from state and import it back, but adding the subdomain blob that was missing from the ID in the broken environments. This ID is what you use to import the resource and it worked fine by using the new URL. Phew, provider now up to the latest and planning cleanly with no changes again!
> azurerm_storage_container.storage_container["document/582c3272-97aa-yyyy-xxxx-redactedguid"]
{
"container_access_type" = "private"
"has_immutability_policy" = false
"has_legal_hold" = false
"id" = "https://redacted-acc.core.windows.net/582c3272-97aa-yyyy-xxxx-redactedguid"
"metadata" = tomap({})
"name" = "582c3272-97aa-yyyy-xxxx-redactedguid"
"resource_manager_id" = "/subscriptions/5acc90e0-7015-yyyy-xxxx-redactedguid/resourceGroups/stg-storage-rg/providers/Microsoft.Storage/storageAccounts/redacted-acc/blobServices/default/containers/582c3272-97aa-yyyy-xxxx-redactedguid"
"storage_account_name" = "redacted-acc"
"timeouts" = {
"create" = tostring(null)
"delete" = tostring(null)
"read" = tostring(null)
"update" = tostring(null)
}
}
> azurerm_storage_container.storage_container["document/582c3272-97aa-yyyy-xxxx-redactedguid"]
{
"container_access_type" = "private"
"has_immutability_policy" = false
"has_legal_hold" = false
"id" = "https://redacted-acc.blob.core.windows.net/582c3272-97aa-yyyy-xxxx-redactedguid"
"metadata" = tomap({})
"name" = "582c3272-97aa-yyyy-xxxx-redactedguid"
"resource_manager_id" = "/subscriptions/974dd827-dc49-yyyy-xxxx-redactedguid/resourceGroups/dh1-storage-rg/providers/Microsoft.Storage/storageAccounts/redacted-acc/blobServices/default/containers/582c3272-97aa-yyyy-xxxx-redactedguid"
"storage_account_name" = "redacted-acc"
"timeouts" = null /* object */
}
No comments:
Post a Comment