-
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
imported azurerm_cdn_endpoint_custom_domain
should not recreated because of Uppercase G in resourceGroups
#14854
Comments
@StefanSchoof Sorry that I can't reproduce this in my local. I've created every resource from Terraform, then create a endpoint custom domain and import it as you stated via Terraform and eveything works fine. I'd like to know how do you create the Also please check the {
"mode": "managed",
"type": "azurerm_cdn_endpoint",
"name": "test",
"provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]",
"instances": [
{
"schema_version": 1,
...
}
]
} |
Normalize the ID using the importer function to conform to what is defined in the ID formatter. This is to mitigate cases like users import resource ID with lowercase 'g' for the resource group. In this case, the current validation in the importer raise no error, which results into the incorrect cased ID leak into terraform state. This will cause the other referencing resource get unexpected plan diff (see hashicorp#14854). This commit adds the helper function for both untyped and typed sdk. The users are expected to pass in a wrapper function around the parse function generated via the resource id tool. While this wrapper might be eliminated once we have generic in Go.
Thanks for your work. I found that much differences in our stages, because we did not use tf for the custom domain previously (a little reminder, that I should always go the extra mile, to have everything in IoC ;) ), that I recreated the custom domain that was affected. I did not think about that this may be needed to get more info for this bug. Sorry. the import was done by the command (found it in my shell history):
|
@StefanSchoof Thank you for confrimation 👍 Meanwhile I've submit a PR #14891, which should hopefully mitigate your incorrect import automatically. |
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. |
Community Note
Terraform (and AzureRM Provider) Version
Terraform v1.1.2
on windows_amd64
Affected Resource(s)
azurerm_cdn_endpoint_custom_domain
Terraform Configuration Files
Debug Output
Panic Output
Expected Behaviour
After importing a existing
azurerm_cdn_endpoint_custom_domain
and a matching terraform config, an apply will not try to recreate theazurerm_cdn_endpoint_custom_domain
. An case change in G ofresourceGroups
should be ignored.Actual Behaviour
terraform want to destroy and recreate the
azurerm_cdn_endpoint_custom_domain
, because the existing resource has an Uppercase G in theendpoint_id
in the/resourceGroups/
and the new should be have a lower case/resourcegroups/
.To acualy delete a custom domain, the DNS CName must removed before and added again after the destroy.
A workaround is to use lifecycle ignore_changes for the cdn_endpoint_id:
Steps to Reproduce
azurerm_cdn_endpoint_custom_domain
Important Factoids
References
azurerm_user_assigned_identity
-> parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups" #14853The text was updated successfully, but these errors were encountered: