Is there an existing issue for this?
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 comments along the lines of "+1", "me too" or "any updates", 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 and review the contribution guide to help.
Terraform Version
1.16.0
AzureRM Provider Version
5.3.0 (regression); confirmed working on 5.2.0
Affected Resource(s)/Data Source(s)
azurerm_site_recovery_replicated_vm
Affected Location(s)
australiasoutheast
Terraform Configuration Files
resource "azurerm_site_recovery_replicated_vm" "xxx-vm1" {
name = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
resource_group_name = azurerm_resource_group.xxx-asr-rg.name
recovery_vault_name = azurerm_recovery_services_vault.xxx-vault.name
source_recovery_fabric_name = azurerm_site_recovery_fabric.primary-fabric.name
source_vm_id = module.xxx-vm1.vm_id
recovery_replication_policy_id = azurerm_site_recovery_replication_policy.xxx-retention-policy.id
source_recovery_protection_container_name = azurerm_site_recovery_protection_container.primary-container.name
target_resource_group_id = azurerm_resource_group.xxx-target-rg.id
target_recovery_fabric_id = azurerm_site_recovery_fabric.recovery-fabric.id
target_recovery_protection_container_id = azurerm_site_recovery_protection_container.recovery-container.id
target_proximity_placement_group_id = azurerm_proximity_placement_group.xxx-ppg.id
managed_disk = [
{
disk_id = "${local.disk_id_prefix}/xxx-vm1-os"
staging_storage_account_id = azurerm_storage_account.xxx-staging-storage.id
target_disk_encryption = []
target_disk_encryption_set_id = azurerm_disk_encryption_set.xxx-des.id
target_disk_type = var.target-disk-type
target_replica_disk_type = var.target-replica-disk-type
target_resource_group_id = azurerm_resource_group.xxx-target-rg.id
},
{
disk_id = "${local.disk_id_prefix}/xxx-vm1-data"
staging_storage_account_id = azurerm_storage_account.xxx-staging-storage.id
target_disk_encryption = []
target_disk_encryption_set_id = azurerm_disk_encryption_set.xxx-des.id
target_disk_type = var.target-disk-type
target_replica_disk_type = var.target-replica-disk-type
target_resource_group_id = azurerm_resource_group.xxx-target-rg.id
},
]
network_interface {
source_network_interface_id = module.xxx-vm1.nic_id
ip_configuration {
target_subnet_name = azurerm_subnet.xxx-subnet.name
failover_test_subnet_name = azurerm_subnet.xxx-subnet.name
}
}
}
Debug Output/Panic Output
Isolated terraform plan output — every field matches between state and config except the casing of the resource group segment in target_disk_encryption_set_id:
# azurerm_site_recovery_replicated_vm.xxx-vm1 must be replaced
-/+ resource "azurerm_site_recovery_replicated_vm" "xxx-vm1" {
~ managed_disk = [ # forces replacement
- {
- target_disk_encryption_set_id = ".../resourceGroups/XXX-KEYVAULT-RG/providers/Microsoft.Compute/diskEncryptionSets/xxx-des"
- target_disk_type = "Premium_LRS"
... (all other fields identical)
},
+ {
+ target_disk_encryption_set_id = ".../resourceGroups/xxx-keyvault-rg/providers/Microsoft.Compute/diskEncryptionSets/xxx-des"
+ target_disk_type = "Premium_LRS"
... (all other fields identical)
},
]
}
Plan: 1 to add, 0 to change, 1 to destroy.
(Two managed_disk entries — OS and data disk — both show the identical pattern.)
Expected Behaviour
Since #33140 (v5.3.0) added update support and a customizeDiff intended to only force-replace when a specific non-updatable attribute changes, unrelated/list-order differences in managed_disk should not force a full block replacement, and genuinely equivalent Azure resource IDs (differing only in segment casing, e.g. resource group name) should not be treated as forcing changes.
Actual Behaviour
Upgrading only the provider version from 5.2.0 → 5.3.0, with no changes to the .tf config, produces a forced replacement of the entire managed_disk list. Reverting to 5.2.0 with the identical config produces a clean/no-op plan.
Separately, attempting to normalise the casing difference by wrapping target_disk_encryption_set_id in lower() causes a hard parse error under 5.3.0:
Error: parsing "...resourcegroups/xxx-keyvault-rg/providers/microsoft.compute/diskencryptionsets/...":
parsing segment "staticResourceGroups": the segment at position 2 didn't match
Expected: .../resourceGroups/.../providers/Microsoft.Compute/diskEncryptionSets/...
Steps to Reproduce
- Have an existing azurerm_site_recovery_replicated_vm where target_disk_encryption_set_id references a disk encryption set inside a resource group whose actual Azure-stored name casing (e.g. XXX-KEYVAULT-RG) differs from the casing used in the Terraform reference/config (e.g. xxx-keyvault-rg) — created under provider ≤5.2.0, where this was a non-issue.
- Upgrade the provider to 5.3.0 with no other config changes.
- Run terraform plan.
- Observe managed_disk # forces replacement driven solely by the casing difference.
Important Factoids
Reverting to provider 5.2.0 with identical config resolves the forced replacement (clean/no-op plan).
References
#33140 (introduced update support + customizeDiff for managed_disk — source of this regression)
#22075 (fixed this exact class of issue on this exact resource before)
#22101 (fixed this exact class of issue on this exact resource before)
Is there an existing issue for this?
Community Note
Terraform Version
1.16.0
AzureRM Provider Version
5.3.0 (regression); confirmed working on 5.2.0
Affected Resource(s)/Data Source(s)
azurerm_site_recovery_replicated_vm
Affected Location(s)
australiasoutheast
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Since #33140 (v5.3.0) added update support and a customizeDiff intended to only force-replace when a specific non-updatable attribute changes, unrelated/list-order differences in managed_disk should not force a full block replacement, and genuinely equivalent Azure resource IDs (differing only in segment casing, e.g. resource group name) should not be treated as forcing changes.
Actual Behaviour
Upgrading only the provider version from 5.2.0 → 5.3.0, with no changes to the .tf config, produces a forced replacement of the entire managed_disk list. Reverting to 5.2.0 with the identical config produces a clean/no-op plan.
Separately, attempting to normalise the casing difference by wrapping target_disk_encryption_set_id in lower() causes a hard parse error under 5.3.0:
Error: parsing "...resourcegroups/xxx-keyvault-rg/providers/microsoft.compute/diskencryptionsets/...":
parsing segment "staticResourceGroups": the segment at position 2 didn't match
Expected: .../resourceGroups/.../providers/Microsoft.Compute/diskEncryptionSets/...
Steps to Reproduce
Important Factoids
Reverting to provider 5.2.0 with identical config resolves the forced replacement (clean/no-op plan).
References
#33140 (introduced update support + customizeDiff for managed_disk — source of this regression)
#22075 (fixed this exact class of issue on this exact resource before)
#22101 (fixed this exact class of issue on this exact resource before)