-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provider 3.27.0 azurerm_cdn_frontdoor_route and azurerm_cdn_frontdoor_custom_domain_association and custom domains #18844
Comments
@slime-uk, thank you for opening this issue, Front Door is an incredibly complex resource with lots of moving parts and very difficult to grok, so I feel your pain. The Terraform crash that you encountered I have already fixed and was caused by the API returning the routes resource ID's with a lower cased The purpose of the new a.) A custom domain or There is nothing I can do about that since that is the design of the API. What the new resource does is on delete updates the routes The last issue you mentioned:
I have not encountered personally, I will spend some time today attempting to reproduce this issue, but setting I hope this has answered a few of your question and feel free to reply with any follow up question you may have. 🚀 |
To help understand how these resources relate to each other I have created this image that I hope helps visually show how they relate to each other and the direction of that relationship... So now knowing the association direction, relationship and the deployment order if you want to decouple your custom domain you will need to do a few extra steps, which I understand is not terrible intuitive, but given how the API design and Terraform are at odds with each other I saw no other way around it. 🙁 To do this you will first have to update your configuration file and remove the reference to the At this point if you run If you Once that I hope this helps make a little bit of sense in regards to the behavior you have been seeing... I don't know about you but I am a visual learner and I have to see it before it clicks in my head personally. 🙂 |
Thanks!
Yes - thanks for all you hard work. I do appreciate that a route must to be associated with a CD or the AzFD default domain (the portal makes this clear). Thanks! However, your comment about the logic where if we are removing the last CD for a given route, it flips link_to_default_domain = true so that the route can stay and the CD can be removed I feel is really good and exactly what we need. Awesome! But in my experience, this is the bit that maybe is not working for us? I will try again to be sure, but I created 2 routes with link_to_default_domain = false but associated to 2 custom domains instead when I defined the route. I also used new resource to associate the CD to the route (although as you say this is not really an association but a dissassociation!) That all worked fine :) I then tried to remove one of the custom domains, and this would have impacted both routes. The new resource was destroyed (as you say), and the portal showed no more associations but TF went onto then destroying the actual custom domain but it failed with message "Error: waiting for the deletion of Front Door Custom Domain: (XXX / Profile Name "YYY" etc.): Code="BadRequest" Message=ErrorMessage Host with Id: XX for tenant Id: YYY is still referenced by partners: ZZZZ"" Here's the TF apply that errored - no op was performed on the route but the new resource was destroyed as you say it should have been - but it then tried and failed to delete the CD even though portal shows no route association. In portal the CD was then showing "failed" as provisioning state: Although - I guess this would not have been the final custom domain - just the 2nd one. Any ideas on this? The same scenario seems to work exactly as you say - but only if when I create the 2 routes, I set link_to_default_domain = true which is not what we really want! Here's the exact same scenario but the routes were defined as link_to_default_domain = true. Note the "no op" on the route did appear to do something! That's the only difference I can see between this successful apply and the above? Again - so many thanks for all the hard work. AzFD is a bit complicated!! |
@slime-uk, that is interesting I have not encountered that issue... but just to make sure I understand your configuration, is the below similar to how you have your environment deployed? If the above image is correct that would mean that you are attempting to delete the Now if that is also correct is the below example what your resource "azurerm_cdn_frontdoor_custom_domain_association" "cronus" {
cdn_frontdoor_custom_domain_id = azurerm_cdn_frontdoor_custom_domain.cronus.id
cdn_frontdoor_route_ids = [azurerm_cdn_frontdoor_route.cronus.id, azurerm_cdn_frontdoor_route.fabrikam.id]
} See Notes and Additional conditions
If all of the above matches your situation, then to delete the custom domain and leave the route in place you will need to do the following steps:
Once the configuration modifications are complete you can This is the desired end state you are looking for correct? If you are still receiving that error I would start looking for other Frontdoor instances that are currently deployed which may have routes that are still associated with the |
@slime-uk, I have engaged the FrontDoor service team to try to get to the bottom of why you are seeing these issues since I am not able to repro your issue locally on my dev box. |
Thanks - FYI - once AzFD is in this state (a custom domain in a failed state), I then have to blow away the entire AzFD to recover. Before that, I tried to get TF to add a new custom domain but of course it tries again first to remove the old (failed state) domain and fails again. No easy way out without deleting the AzFD in the portal. You can't delete the failed CD in the portal either - same error. The only solution I have found is to delete the entire AzFD. |
@slime-uk, the service team is saying they "cannot find any custom domain/endpoint name/host name contains “skgdom1” from our kusto query" Can you give us anything more identifiable so we can search our internal logs to see what is happening? |
Sadly, I just tore it all down again! Happy to try and recreate - or can they look through logs even though it's gone? If so, can I PM you the full details of the domain? |
@slime-uk, it doesn't matter if it is gone or not... just send me the info and I will pass that on to the service team... |
@slime-uk, also as a side note, have you looked at your activity log in portal to see if it can add anymore context as to why you are getting this error... make sure you click the |
@slime-uk, thank you for that info... I have removed the comment, but I believe I have found your calls in our internal service trace logs... currently working with service team to track down the root cause thank you. 🙂 |
@slime-uk... this is starting to look like a race condition in the service code... from the logs, it shows that the domains are still associated even though the UI shows that they are not... 😭 |
Makes sense - it seems hit and miss as per the above, one day it seems to delete the associations (completely) and one day maybe it doesn't but thinks it has and then tries to delete the custom domain (too early) |
@slime-uk, the service team just confirmed that this is in fact caused by a race condition in the service and that they are prioritizing a fix for this issue. Per the service team:
Meaning that the delete operation will try over and over again until it eventually times out and that explains why you were seeing the error you were seeing and why I was not able to reproduce it because my repro did not include a rule for the route. |
@slime-uk, if it is OK with you I would like to close this issue as this is not an issue with the Terraform resources, but rather an upstream issue with the actual service. |
Sure! Thank you for looking into it and raising with the service team. Over and above effort from you and I thank you. I will close with this comment. Thanks again. |
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. |
Is there an existing issue for this?
Community Note
Terraform Version
1.1.9
AzureRM Provider Version
3.27.0
Affected Resource(s)/Data Source(s)
azurerm_cdn_frontdoor_route azurerm_cdn_frontdoor_custom_domain_association azurerm_cdn_frontdoor_custom_domain
Terraform Configuration Files
Debug Output/Panic Output
I have previously opened an issue where all this is provided - so please see existing issue #18656
Expected Behaviour
We expect to be able to create all needed AzFD resources (profile, origin groups, origins and routes ideally not linked to default AzFD endpoint/domain but portal does not allow this) and then associate to AzFD custom domains as and when using the new resource
azurerm_cdn_frontdoor_custom_domain_association
. We'd also like to delete AzFD custom domains and ensure Terraform knows the correct order to delete (i.e. first remove the custom domain from any subsequent route associations).Actual Behaviour
This does work in 3.27.0 (see my comments on my issue #18656) but only if you
azurerm_cdn_frontdoor_custom_domain_association
to also set associations from custom domains to routesIf you then try and remove a custom domain later, Terraform appears to understand the order and deletes successfully.
However, if you do the above but set link_to_default_domain = false, although the creation works fine, on deletion of an AzFD custom domain, we get an error that the domain is still associated to a route by partner id - see later commnets on #18656
Steps to Reproduce
See #18656
Important Factoids
No response
References
#18656
The text was updated successfully, but these errors were encountered: