Remove validation on GCF regions (#3530)

* adding additional GCF regions supported 

Fixes https://github.com/terraform-providers/terraform-provider-google/issues/3515 
https://cloud.google.com/functions/docs/locations

* remove region validation from google cloud functions

* remove for region check resource creation
This commit is contained in:
Stanley Zheng 2019-05-03 13:56:27 -04:00 committed by Riley Karson
parent a648430f2d
commit 98389c0a0f

View File

@ -27,10 +27,6 @@ var functionAllowedMemory = map[int]bool{
2048: true,
}
// For now CloudFunctions are allowed only in the following locations.
// Please see https://cloud.google.com/about/locations/
var validCloudFunctionRegion = validation.StringInSlice([]string{"us-central1", "us-east1", "europe-west1", "asia-northeast1"}, true)
const functionDefaultAllowedMemoryMb = 256
type cloudFunctionId struct {
@ -283,11 +279,10 @@ func resourceCloudFunctionsFunction() *schema.Resource {
},
"region": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validCloudFunctionRegion,
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
},
}
@ -305,14 +300,6 @@ func resourceCloudFunctionsCreate(d *schema.ResourceData, meta interface{}) erro
if err != nil {
return err
}
// We do this extra validation here since most regions are not valid, and the
// error message that Cloud Functions has for "wrong region" is not specific.
// Provider-level region fetching skips validation, because it's not possible
// for the provider-level region to know about the field-level validator.
_, errs := validCloudFunctionRegion(region, "region")
if len(errs) > 0 {
return errs[0]
}
cloudFuncId := &cloudFunctionId{
Project: project,