Skip to content

Commit

Permalink
Merge pull request #8042 from johejo/allow_location_global
Browse files Browse the repository at this point in the history
allow "global" for enhanced location validation
  • Loading branch information
tombuildsstuff authored Aug 7, 2020
2 parents 18797c8 + e55d032 commit 56a2e98
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions azurerm/internal/location/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func enhancedValidation(i interface{}, k string) ([]string, []error) {
}

if !found {
// Some resources use a location named "global".
if normalizedUserInput == "global" {
return nil, nil
}

locations := strings.Join(*supportedLocations, ",")
return nil, []error{
fmt.Errorf("%q was not found in the list of supported Azure Locations: %q", normalizedUserInput, locations),
Expand Down
13 changes: 13 additions & 0 deletions azurerm/internal/location/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func TestEnhancedValidationDisabled(t *testing.T) {
input: "West Europe",
valid: true,
},
{
input: "global",
valid: true,
},
}
enhancedEnabled = false
defer func() {
Expand Down Expand Up @@ -73,6 +77,10 @@ func TestEnhancedValidationEnabledButIsOffline(t *testing.T) {
input: "West Europe",
valid: true,
},
{
input: "global",
valid: true,
},
}
enhancedEnabled = true
supportedLocations = nil
Expand Down Expand Up @@ -143,6 +151,11 @@ func TestEnhancedValidationEnabled(t *testing.T) {
input: "West Europe",
valid: false,
},
{
availableLocations: publicLocations,
input: "global",
valid: true,
},
}
enhancedEnabled = true
defer func() {
Expand Down

0 comments on commit 56a2e98

Please sign in to comment.