Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_cosmosdb_account modifying geo_location no longer triggers a recreation of the resource #7217

Merged
merged 2 commits into from Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions azurerm/helpers/azure/location.go
Expand Up @@ -17,6 +17,10 @@ func SchemaLocationForDataSource() *schema.Schema {
return location.SchemaComputed()
}

func SchemaLocationWithoutForceNew() *schema.Schema {
return location.SchemaWithoutForceNew()
}

// azure.NormalizeLocation is a function which normalises human-readable region/location
// names (e.g. "West US") to the values used and returned by the Azure API (e.g. "westus").
// In state we track the API internal version as it is easier to go from the human form
Expand Down
12 changes: 12 additions & 0 deletions azurerm/internal/location/schema.go
Expand Up @@ -36,6 +36,18 @@ func SchemaComputed() *schema.Schema {
}
}

// Schema returns the Schema which should be used for Location fields
// where these are Required and can be changed
func SchemaWithoutForceNew() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Required: true,
ValidateFunc: EnhancedValidate,
StateFunc: StateFunc,
DiffSuppressFunc: DiffSuppressFunc,
}
}

func DiffSuppressFunc(_, old, new string, _ *schema.ResourceData) bool {
return Normalize(old) == Normalize(new)
}
Expand Down
Expand Up @@ -151,7 +151,7 @@ func resourceArmCosmosDbAccount() *schema.Resource {
Computed: true,
},

"location": azure.SchemaLocation(),
"location": azure.SchemaLocationWithoutForceNew(),

"failover_priority": {
Type: schema.TypeInt,
Expand Down