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

commonschema: adding support for Extended Location #97

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions resourcemanager/commonschema/location.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@ package commonschema
import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)

func ExtendedLocation() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Required: true,
Copy link

@neil-yechenwei neil-yechenwei Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tombuildsstuff . Per my understanding, seems it's an optional property. If I am wrong, please correct me. Because it allows customers to take advantage of more granular locations when this property is set. If user doesn't set it, the resource would be deployed to normal location like "West Europe". Does it make sense?

ForceNew: true,
StateFunc: location.StateFunc,
DiffSuppressFunc: location.DiffSuppressFunc,
ValidateFunc: validation.StringIsNotEmpty,
Copy link

@neil-yechenwei neil-yechenwei Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though there is a list API to retrieve available extended locations, but it has to be whitelisted by service team first before calling this API. So I assume here is not proper to add a property validation using this API for extendedLocation like the location validation to validate available extendedLocation since it would break existing users/resources when user already knew the extended location so that user doesn't want this check. So if added property validation here, user has to gain the additional permission for this check even if it's unnecessary to users. Does it make sense?

}
}

func Location() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Expand Down