-
Notifications
You must be signed in to change notification settings - Fork 43
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
ForceNew: true, | ||
StateFunc: location.StateFunc, | ||
DiffSuppressFunc: location.DiffSuppressFunc, | ||
ValidateFunc: validation.StringIsNotEmpty, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, | ||
|
There was a problem hiding this comment.
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?