-
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
azurerm_virtual_machine
- VM Size should be case insensitive
#487
Comments
I'm also seeing this with vm_size: ~ module.test.azurerm_virtual_machine.vm[0] |
and on VM network interface attachments: network_interface_ids.#: "1" => "1" "Microsoft.Network" v. "Microsoft.network". |
This is still a problem in 1.0.1. |
hey @clangaxon Thanks for opening this issue In general Providers in Terraform are case sensitive (for instance in the AWS and GCP Providers are mostly case sensitive) - for the Azure Provider we have a little bit of leeway since folks are coming from ARM Templates which mostly is case insensitive. Unfortunately this doesn't apply to all fields, since certain Azure API's are case sensitive - and Terraform requires ID's to be case sensitive: So to reply to each issue in-line:
Resource Group names are inconsistent through Azure - in some API's they're case sensitive, whereas in others they're case insensitive. As this is such a common field (it's on every resource) - I think it's better to be consistent here and not make this field case insensitive, than be inconsistent throughout resources. As such, we'd recommend updating the Resource Group Name in your Terraform Configuration to match the casing used in Azure.
Users commonly write the VM Size in a different case (either all upper or all lower case) than Azure returns. Since the API isn't case sensitive here - @echuvyrov is going to send a PR to make this field case insensitive.
Given this is an identifier Terraform requires that this is case sensitive (since we split the URI into a Map/Dictionary and access the values by their case sensitive names) - as such we can't update this field to be case insensitive. Technically what's happening here is that the In the mean time - to resolve this issue you should be able to update the input data from Given the outstanding issue is related to the VM Size - I'm going to update the title of this issue to mention this; and @echuvyrov should be adding a fix for this in the near future. Thanks! |
azurerm_virtual_machine
- VM Size should be case insensitive
Hi @clangaxon, I tried to repro the issue with vm_size casing, but cannot seem to duplicate it. Is it possible to provide a small repro script/scenario? I tried running the block of code below with both "Standard_DS13_v2" and "Standard_DS13_V2" and successive applies do not detect the changes after initial deploy.
|
I disagree with not fixing this because the case change doesn't apply. If it can't be applied, it makes more sense for Terraform be aware that Azure doesn't consider it a change and not to try to apply it repeatedly. Since it behaves this way, it seems that this API is not case sensitive either and the same conclusion would be reached as for vm sizes?
We aren't hard coding a resource id: all of these were either created by Terraform or imported. In this case the NIC is "Microsoft.network" and the VM is "Microsoft.Network". Removing the state of both "corrects" the NIC to "Microsoft.Network", but ironically, now they disagree on the actual NIC name - the NIC id imports as "hostnameNetworkInterface" and the VM imports as "hostnamenetworkInterface". This may be the result of some old state transition, variances across Terraform versions, or internal changes in Azure, but the underlying problem here is, as in both other cases, that Azure appears case-insensitive since the case change continually reapplies but changes nothing. This may be challenging to fix due to the URI splitting, but so far I don't see a work-around. |
@clangaxon I have submitted the following PR for a data source on network interfaces. #854 Please share any feedback that you may have. |
Another case sensitivity issue:
The difference in protocol case alone won't trigger a change, but if another change triggers an NSG change, it lists all the differences in protocol capitalization. |
@dcaro That seems like a nice addition, but I'm not sure how that addresses our issue of the states getting out of sync between Azure and multiple tfstate references to a NIC? We build the NIC and attach it to a VM ... |
@echuvyrov is the VM size issue fixed ? |
Windows 10 environment only:
Even you don't have any code change, the terraform plan will always report it needs to create a new resource group:
@jeffreyCline we need to fix this issue for arm_resource_group, although API tolerate this duplicated call. |
I am still not able to repro this issue on Linux, this maybe a Windows only bug. I will attempt to repro the issue on a Windows OS.
|
@metacpp @jeffreyCline heads up that’s a regression with Windows that’s been fixed in Terraform 0.11.5, released earlier today |
@jeffreyCline please double confirm if all the casing issues discussed in this thread are fixed by 0.11.5. |
Issue ListLinux
Windows
Configuration
@jeffreyCline please use this list to update the validation result and the action items. |
@metacpp @jeffreyCline sorry, to clarify in this comment I was referring to this comment:
which was broken in |
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! |
Example:
~ azurerm_storage_account.mystorageaccount
resource_group_name: "myresourcegroup" => "MyResourceGroup"
apply does nothing, so it always shows as an outstanding change in 0.3.2.
The text was updated successfully, but these errors were encountered: