You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
data "external" "apis_hostkeys" {
for_each = toset(var.function_app_names)
program = ["bash", "-c", "az rest --method post --uri ${data.azurerm_resource_group.app_target_rg.id}/providers/Microsoft.Web/sites/${azurerm_function_app.apis[each.key].name}/host/default/listKeys?api-version=2018-11-01 --query functionKeys"]
depends_on = [
azurerm_function_app.apis
]
}
resource "azurerm_api_management_named_value" "apis_backend_code" {
for_each = toset(var.function_app_names)
name = "${each.key}-function-code-${local.semantic_version}"
resource_group_name = data.azurerm_resource_group.app_target_rg.name
api_management_name = data.azurerm_api_management.apim.name
display_name = "${each.key}-function-code-${local.semantic_version}"
value = data.external.apis_hostkeys[each.key].result.default
secret = true
}
Debug Output
data.external.apis_hostkeys["devices"]: Refreshing state...
azurerm_api_management_named_value.apis_backend_code["devices"]: Creating...
Error: retrieving Property "devices-function-code-0-1-2" (Resource Group "***" / API Management Service "****-apim-***"): apimanagement.NamedValueClient#Get: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="Property not found."
on functions.tf line 79, in resource "azurerm_api_management_named_value" "apis_backend_code":
79: resource "azurerm_api_management_named_value" "apis_backend_code" {
Expected Behavior
Named value is created in Azure and terraform exits successfully.
Actual Behavior
This is intermittent race condition, but happens often enough to break our pipeline 2 days in a row.
The named value is created in Azure, but terraform fails to fetch/get the resource since Azure has not yet finished creating it.
This then means that the resources is successfully created but the TF state does not know about the created resource. In order to fix it, we need to manually import the resource into the state or delete the resources and try again.
Steps to Reproduce
Try to deploy new named value many times.
Eventually, the deployment will fail when it tries to "get" the resource right after creation.
References
This seems to be related to a recently fixed bug for azurerm_api_management_api resource having a similar problem. We likely need to add the same "future" fix for the named values resource as well.
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 👉 [email protected]. Thanks!
ghost
locked and limited conversation to collaborators
Jul 31, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Terraform (and AzureRM Provider) Version
Terraform: v0.12.26
AzureRM Provider: v2.8.0
Affected Resource(s)
azurerm_api_management_named_value
Terraform Configuration Files
Debug Output
Expected Behavior
Named value is created in Azure and terraform exits successfully.
Actual Behavior
This is intermittent race condition, but happens often enough to break our pipeline 2 days in a row.
The named value is created in Azure, but terraform fails to fetch/get the resource since Azure has not yet finished creating it.
This then means that the resources is successfully created but the TF state does not know about the created resource. In order to fix it, we need to manually import the resource into the state or delete the resources and try again.
Steps to Reproduce
References
This seems to be related to a recently fixed bug for azurerm_api_management_api resource having a similar problem. We likely need to add the same "future" fix for the named values resource as well.
azurerm_api_management_api
correctly wait for future on create/update #7273The text was updated successfully, but these errors were encountered: