diff --git a/internal/services/appconfiguration/app_configuration_resource.go b/internal/services/appconfiguration/app_configuration_resource.go index de2af0a036ce5..a14759c4c18ca 100644 --- a/internal/services/appconfiguration/app_configuration_resource.go +++ b/internal/services/appconfiguration/app_configuration_resource.go @@ -778,22 +778,19 @@ func expandAppConfigurationReplicas(input []interface{}, configurationStoreName, // check if there are duplicated replica names or locations // location cannot be same as original configuration store and other replicas - const placeholder = "" - locationSet := map[string]string{ - configurationStoreLocation: placeholder, - } + locationSet := map[string]string{} replicaNameSet := map[string]struct{}{} for _, v := range input { replica := v.(map[string]interface{}) 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) + } if name, ok := locationSet[replicaLocation]; ok { - if name == placeholder { - return nil, fmt.Errorf("replica %q location %q is duplicated with original configuration store %q", replicaName, replicaLocation, configurationStoreName) - } - return nil, fmt.Errorf("replica %q location %q is duplicated with replica %q", replicaName, replicaLocation, name) + return nil, fmt.Errorf("location (%q) of replica %q is duplicated with replica %q", replicaName, replicaLocation, name) } locationSet[replicaLocation] = replicaName