Open twexler opened 1 year ago
Example plan:
module.cluster.module.sec_groups.azurerm_network_security_group.my_cool_security_group: Refreshing state... [id=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.Network/networkSecurityGroups/my-cool-security-group]
module.cluster.module.sec_groups.azurerm_network_security_rule.outbound: Refreshing state... [id=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.Network/networkSecurityGroups/my-cool-security-group/securityRules/my-cool-security-group-outbound]
Note: Objects have changed outside of Terraform
Terraform detected the following changes made outside of Terraform since the last "terraform apply" which may have affected this plan:
# module.cluster.module.sec_groups.azurerm_network_security_group.my_cool_security_group has changed
~ resource "azurerm_network_security_group" "my_cool_security_group" {
id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.Network/networkSecurityGroups/my-cool-security-group"
~ name = "my-cool-security-group" -> "MY-COOL-SECURITY-GROUP"
# (3 unchanged attributes hidden)
# (1 unchanged block hidden)
}
Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to these changes.
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
# module.cluster.module.sec_groups.azurerm_network_security_rule.outbound must be replaced
-/+ resource "azurerm_network_security_rule" "outbound" {
- destination_address_prefixes = [] -> null
- destination_application_security_group_ids = [] -> null
- destination_port_ranges = [] -> null
~ id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.Network/networkSecurityGroups/my-cool-security-group/securityRules/my-cool-security-group-outbound" -> (known after apply)
name = "my-cool-security-group-outbound"
~ network_security_group_name = "my-cool-security-group" -> "MY-COOL-SECURITY-GROUP" # Forces replacement
- source_address_prefixes = [] -> null
- source_port_ranges = [] -> null
# (9 unchanged attributes hidden)
}
Plan: 1 to add, 0 to change, 1 to destroy.
Opened similar case here https://github.com/hashicorp/terraform-provider-azurerm/issues/24893
Is there any update/progress on this?
@tombuildsstuff will this change to hashicorp/go-azure-sdk
mentioned here resolve the situation per se or is this a prerequisite? Is this change being tracked elsewhere?
Also, if I get it right, there are two workarounds mentioned - the first being to ignore_changes
on the subject value (which is imho unacceptable), second one being by matching the casing being returned for this field
which is supposing to handle it at specific place in provider's code base
Summary: no fix possible in user tf code at the moment.
Is there an existing issue for this?
Community Note
Terraform Version
1.3.0
AzureRM Provider Version
3.39.1
Affected Resource(s)/Data Source(s)
azurerm_resource_group, azurerm_network_security_group
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
terraform-provider-azurerm
should produce a clean plan when the Azure API returns case-insensitive resource namesActual Behaviour
terraform-provider-azurerm
produces plans that attempt to revert casing to the defined casing in the terraform manifestSteps to Reproduce
terraform apply
an azurerm resource with a nameterraform plan
will produce a plan that attempts to revert casing to the manifest's casingImportant Factoids
No response
References
Azure themselves (after opening a support case in hopes that they're realize this is a bug and not a feature) insists that their API will never honor casing and users of their API should not expect casing to be consistent for certain values returned by their API.