Closed mcalnd70 closed 3 years ago
I've done a lot of RCA on this and I believe I have discovered the reason. I'm working through the post mortem of it now. Please don't assign this to anyone, I'll endeavour to post back some findings for the community in due course.
This can now be closed - I eventually found the issue via a lot of trial and error. The appsetting "AzureWebJobsStorage" was changed via a FA code CI/CD pipeline to become a Key Vault Reference object. This conflicted with the Terraform main.tf's definition of "storage_connection_string", no a KV Reference Object.
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!
Community Note
Terraform (and AzureRM Provider) Version
Terraform 0.12.20 (also tried 0.13.5 to attempt to fix) AzureRM Provider 2.16.0 (also tried 2.36.0 to attempt to fix)
Affected Resource(s)
azurerm_function_app
Terraform Configuration Files
Debug Output
Panic Output
Expected Behaviour
Plan reports
No changes. Infrastructure is up-to-date.
as nothing has changed versus the state fileActual Behaviour
Plan reports that the Function App must be replaced - but the reason given that forces this replacement is unclear. As far as I can see the (a) the resource exists in Azure correctly (b) the state is saved correctly.
I have run the following commands to remove the state and re-import...
terraform state rm azurerm_function_app.go-1
terraform import azurerm_function_app.go-1 /subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/MyFunctionApp
...however the PLAN output still demands
azurerm_function_app.go-1 must be replaced
. It's not exactly clear what is forcing this replacement demand, having checked out the running Function App in Azure, the Azure Resource Manager site, the contents of the state file (before and after, and when doing the re-import into the statefileOf note: the following items are marked as - red in the PLAN output...
Steps to Reproduce
terraform init
terraform plan
Important Factoids
West Europe region of Azure - Function Apps have been running for around 1 year. I'm unsure if this is a Terraform issue, or an Azure API or Resource Manager backend issue, but so far I have been unable to understand what the exact issue is.
References
0000