pulumi-azure-native
pulumi-azure-native copied to clipboard
Resource Ids should be compared case-insensitively
Resource IDs have case-insensitive components, and so must be compared in a case-insensitive way to avoid a spurious diff. See https://github.com/pulumi/pulumi-azure-native/issues/3964 for an example, in which the subnet ID of an imported KeyVault resource is erroneously being treated as different from the resource ID on the Subnet resource.
From "Naming rules and restrictions for Azure resources":
Resource and resource group names are case-insensitive unless specifically noted in the Valid Characters column.
When using various APIs to retrieve the name for a resource or resource group, the returned value might have different casing than what you originally specified for the name. The returned value could also display different case values than what is listed in the Valid Characters column.
Always perform a case-insensitive comparison of names.
Doing this might involve using schema information during diff to know how to compare the values. It might also involve schema overrides.
Some interesting links:
- https://github.com/hashicorp/terraform-provider-azurerm/tree/main/internal/tools/generator-resource-id
- https://github.com/hashicorp/go-azure-helpers/tree/main/resourcemanager/commonids