terraform-provider-azurerm: Front Door: Upgrade 2.57 -> 2.58 breaks on existing FD instances with inline HTTPS configuration
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave “+1” or “me too” comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform (and AzureRM Provider) Version
AzureRM: 2.57 & 2.58 Terraform: 0.14.11
Affected Resource(s)
azurerm_frontdoor
azurerm_frontdoor_custom_https_configuration
Terraform Configuration Files
For 2.57
resource "azurerm_frontdoor" "fd" {
name = "sample-frontdoor-brc"
resource_group_name = azurerm_resource_group.rg.name
enforce_backend_pools_certificate_name_check = true
tags = {
"Version" = "4.0.2"
}
backend_pool {
health_probe_name = "health-probe"
load_balancing_name = "backend-lb"
name = "backend"
backend {
address = "www.bing.com"
host_header = "www.bing.com"
http_port = 80
https_port = 443
}
}
backend_pool_load_balancing {
name = "backend-lb"
}
backend_pool_health_probe {
<snipped for brevity>
}
frontend_endpoint {
name = "default"
host_name = "sample-frontdoor-brc.azurefd.net"
}
frontend_endpoint {
name = "custom"
host_name = "sample-frontdoor-brc.sandbox.provider.engineering"
custom_https_provisioning_enabled = true
custom_https_configuration {
certificate_source = "FrontDoor"
}
}
routing_rule {
<snipped for brevity>
}
}
For 2.58
resource "azurerm_frontdoor" "fd" {
name = "sample-frontdoor-brc"
resource_group_name = azurerm_resource_group.rg.name
enforce_backend_pools_certificate_name_check = true
tags = {
"Version" = "4.0.2"
}
backend_pool {
<snipped for brevity>
}
backend_pool_load_balancing {
name = "backend-lb"
}
backend_pool_health_probe {
<snipped for brevity>
}
frontend_endpoint {
name = "default"
host_name = "sample-frontdoor-brc.azurefd.net"
}
frontend_endpoint {
name = "custom"
host_name = "sample-frontdoor-brc.sandbox.provider.engineering"
}
routing_rule {
<snipped for brevity>
}
}
resource "azurerm_frontdoor_custom_https_configuration" "fd_custom_url" {
frontend_endpoint_id = azurerm_frontdoor.fd.frontend_endpoint[1].id
custom_https_provisioning_enabled = true
custom_https_configuration {
certificate_source = "FrontDoor"
}
}
Debug Output
Post a comment below if it is needed. I have to make sure that the debug output does not contain any sensitive info before I put it here in the issue or in a paste bin.
Panic Output
N/A
Expected Behaviour
Unsure really. Are we supposed to delete the Front Door first before going from 2.57 to 2.58? Or is it supposed to just ignore the existing certificate on the Front Door.
Actual Behaviour
First error when running terraform apply
:
azurerm_frontdoor.fd: Modifying... [id=/subscriptions/[redacted]/resourceGroups/frontdoor-issue-brc/providers/Microsoft.Network/frontDoors/sample-frontdoor-brc]
azurerm_frontdoor.fd: Modifications complete after 3s [id=/subscriptions/[redacted]/resourceGroups/frontdoor-issue-brc/providers/Microsoft.Network/frontDoors/sample-frontdoor-brc]
azurerm_frontdoor_custom_https_configuration.fd_custom_url: Creating...
Error: updating Custom HTTPS configuration for Frontend Endpoint "custom"
(Front Door "sample-frontdoor-brc" / Resource Group "frontdoor-issue-brc"): unable to enable/update Custom Domain HTTPS for Frontend Endpoint "custom" (Resource Group "frontdoor-issue-brc"): enabling Custom Domain HTTPS for Frontend Endpoint: frontdoor.FrontendEndpointsClient#EnableHTTPS: Failure sending request: StatusCode=0 -- Original Error: Code="BadRequest" Message="That action isn’t allowed in this profile."
Second error when running terraform apply
:
azurerm_frontdoor_custom_https_configuration.fd_custom_url: Creating...
Error: updating Custom HTTPS configuration for Frontend Endpoint "custom" (Front Door "sample-frontdoor-brc" / Resource Group "frontdoor-issue-brc"): unable to enable/update Custom Domain HTTPS for Frontend Endpoint "custom"
(Resource Group "frontdoor-issue-brc"): enabling Custom Domain HTTPS for Frontend Endpoint:
frontdoor.FrontendEndpointsClient#EnableHTTPS: Failure sending request: StatusCode=0 -- Original Error:
Code="OperationNotAllowed" Message="Frontend endpoint custom is already secured with a managed certificate.
Only the Minimum TLS Version property for a managed certificate configuration can be updated. All other updates are not suppored."
Steps to Reproduce
- Pin your configuration to AzureRM 2.57 (or earlier)
- Create a Front Door resource using the custom HTTPS configuration inline resource
terraform apply
- DO NOT DESTROY!
- Remove the pinned version so that AzureRM 2.58 can be downloaded
- You may have to run
terraform init -upgrade
because of the lock file
- You may have to run
- Remove the inline configuration in
azurerm_frontdoor
. - Add the custom HTTPS configuration through
azurerm_frontdoor_custom_https_configuration
terraform apply
- Change nothing and run
terraform apply
for the second error
Important Factoids
N/A
References
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 18 (5 by maintainers)
Commits related to this issue
- fixed #11623 * Support import for custom https configuration * Update import path * Update azurerm/internal/services/frontdoor/frontdoor_custom_https_configuration_resource.go * Add tests, a... — committed to hashicorp/terraform-provider-azurerm by WodansSon 3 years ago
- fixed #11623 * Support import for custom https configuration * Update import path * Update azurerm/internal/services/frontdoor/frontdoor_custom_https_configuration_resource.go * Add tests, a... — committed to gro1m/terraform-provider-azurerm by WodansSon 3 years ago
@timja @cpressland
I am seeing this confusion creep in more and more… thinking about putting a check in the code if it sees latest just to ignore it and send an empty string instead or maybe a validation rule that would error out if the word latest was passed as the version field value. 🤔
@bcline760, I have updated the
azurerm_frontdoor_custom_https_configuration
code to support state import:What this means is that once you upgrade your provider with an existing Frontdoor resource to v2.58.0 all you will need to do is to update your configuration file with the new
azurerm_frontdoor_custom_https_configuration
block stub and import it like this:Stub example
Import command example
Once you do that, the
azurerm_frontdoor_custom_https_configuration
resource will be written into your state file. Now that it is imported the last step is to add the correct values to your stubs in your configuration file like this:Update configuration stub values example
Once you update your configuration file to include the correct values that exist in azure for your
azurerm_frontdoor_custom_https_configuration
resource all you need to do now is runterraform plan
:Well I’ve upgraded ~15 frontdoors with 100s of endpoints using my own cert with the above scenario and no issues.
for the record I used this when testing frontdoor to create my own certs that were valid: https://github.com/shibayan/keyvault-acmebot
You just need a sub-domain you own and then it’s trivial to setup more certs
You did the exact setup I did and yours didn’t break at all? I’m curious as to why mine broke.
Are you putting the literal string latest in or is that referring to a version? If you want the latest version you should not specify a version (leave out the attribute)
So far, I’ve had mixed success with this version, we’ve not been able to configure Front Door in Terraform for nearly a year now, so its had lots of Azure Portal modifications. On the plus side, Terraform can now manage the Front Door object itself just fine, but custom HTTPS resources are completely broken for us.
We began with a front door sub resource as follows:
this was modified to:
and then an additional resource added:
On the initial Terraform apply the Front Door object itself was modified and all Custom HTTPS Certificates were deprovisioned as expected. However, when attempting to add the new resource type we get the following error:
The above led me here, and I attempted to remove all associated records completely as per the recommendations in “The Hard Way” from @WodansSon - unfortunately after completing this we still had the same error:
Checking the JSON payload in resources.azure.com showed that above resource didn’t change all that much between applies, obviously it disappeared, but when it came back it was identical beyond a slight ordering difference.
I then attempted to create this resource with:
Which worked! As such, I still think we have an issue here when using Azure Key Vault with a
azurerm_frontdoor_custom_https_configuration
resource. Any suggestions on this @WodansSon?I didn’t have to do anything migrating have an azurerm_frontdoor (from 2.41.0) with inline custom_https_configuration to the separate resource, the first apply just worked