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

Online validation of plan, region #115

Closed
dentarg opened this issue Sep 27, 2021 · 3 comments
Closed

Online validation of plan, region #115

dentarg opened this issue Sep 27, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@dentarg
Copy link
Member

dentarg commented Sep 27, 2021

Instead of hard coding all the plan names here:

func validatePlanName() schema.SchemaValidateFunc {
return validation.StringInSlice([]string{
"lemur", "tiger",
"bunny", "rabbit", "panda", "ape", "hippo", "lion",
"squirrel-1", "bunny-1", "bunny-3",
"rabbit-1", "rabbit-3", "rabbit-5",
"panda-1", "panda-3", "panda-5",
"ape-1", "ape-3", "ape-5",
"hippo-1", "hippo-3", "hippo-5",
"lion-1", "lion-3", "lion-5",
"rhino-1",
}, true)

Perhaps we can use the method outlined in hashicorp/terraform-plugin-sdk#101 (comment) and use our API to validate the plan name.

Same goes for region, where we have no validation in the provider today, our API could be used to validate the given region.

@dentarg dentarg added the enhancement New feature or request label Sep 27, 2021
@dentarg dentarg changed the title Online/Network/API validation (plan, region) Online validation of plan, region Oct 5, 2021
@dentarg
Copy link
Member Author

dentarg commented Oct 19, 2022

@tbroden84
Copy link
Contributor

Tested to add online validation for region in our API backend. Made it reachable through go-api and passed along 'ApiBaseUrl'. Can be set similar to 'apikey' and 'baseurl' in the provider configuration.

customdiff.ValidateValue("region", func(value, meta interface{}) error {
  api := meta.(*api.API)
  result, err := api.ValidateRegion(ApiBaseUrl, value.(string))
  if result {
    return nil
  }
    return err
}),

Could be the way to go to move the validation to our backend instead.

@tbroden84
Copy link
Contributor

Implemented in: #201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants