diff --git a/internal/services/appconfiguration/app_configuration.go b/internal/services/appconfiguration/app_configuration.go index b54c2d691f1e..15a94babf315 100644 --- a/internal/services/appconfiguration/app_configuration.go +++ b/internal/services/appconfiguration/app_configuration.go @@ -11,6 +11,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/configurationstores" "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -44,7 +45,7 @@ func flattenAppConfigurationReplicas(input []replicas.Replica) ([]interface{}, e result := map[string]interface{}{ "name": pointer.From(v.Name), - "location": pointer.From(v.Location), + "location": location.Normalize(pointer.From(v.Location)), "endpoint": pointer.From(v.Properties.Endpoint), "id": replicaId.ID(), } @@ -57,7 +58,7 @@ func resourceConfigurationStoreReplicaHash(input interface{}) int { var buf bytes.Buffer if rawData, ok := input.(map[string]interface{}); ok { buf.WriteString(rawData["name"].(string)) - buf.WriteString(rawData["location"].(string)) + buf.WriteString(location.Normalize(rawData["location"].(string))) } return pluginsdk.HashString(buf.String()) } diff --git a/internal/services/appconfiguration/app_configuration_resource.go b/internal/services/appconfiguration/app_configuration_resource.go index bf82774cff05..5d62e1c0605f 100644 --- a/internal/services/appconfiguration/app_configuration_resource.go +++ b/internal/services/appconfiguration/app_configuration_resource.go @@ -792,11 +792,11 @@ func expandAppConfigurationReplicas(input []interface{}, configurationStoreName, replicaName := replica["name"].(string) replicaLocation := location.Normalize(replica["location"].(string)) if strings.EqualFold(replicaLocation, configurationStoreLocation) { - return nil, fmt.Errorf("location (%q) of replica %q is duplicated with original configuration store %q", replicaName, replicaLocation, configurationStoreName) + return nil, fmt.Errorf("location (%q) of replica %q is duplicated with original configuration store %q", replicaLocation, replicaName, configurationStoreName) } if name, ok := locationSet[replicaLocation]; ok { - return nil, fmt.Errorf("location (%q) of replica %q is duplicated with replica %q", replicaName, replicaLocation, name) + return nil, fmt.Errorf("location (%q) of replica %q is duplicated with replica %q", replicaLocation, replicaName, name) } locationSet[replicaLocation] = replicaName @@ -807,7 +807,7 @@ func expandAppConfigurationReplicas(input []interface{}, configurationStoreName, replicaNameSet[normalizedReplicaName] = struct{}{} if len(replicaName)+len(configurationStoreName) > 60 { - return nil, fmt.Errorf("replica name %q is too long, the total length of replica name and configuration store name should be greater than 60", replicaName) + return nil, fmt.Errorf("replica name %q is too long, the total length of replica name and configuration store name should be less or equal than 60", replicaName) } result = append(result, replicas.Replica{