diff --git a/builtin/providers/aws/config.go b/builtin/providers/aws/config.go index 33c9d2cae..b5ce7184b 100644 --- a/builtin/providers/aws/config.go +++ b/builtin/providers/aws/config.go @@ -92,6 +92,7 @@ type Config struct { Insecure bool SkipCredsValidation bool + SkipRegionValidation bool SkipRequestingAccountId bool SkipMetadataApiCheck bool S3ForcePathStyle bool @@ -153,10 +154,14 @@ type AWSClient struct { func (c *Config) Client() (interface{}, error) { // Get the auth and region. This can fail if keys/regions were not // specified and we're attempting to use the environment. - log.Println("[INFO] Building AWS region structure") - err := c.ValidateRegion() - if err != nil { - return nil, err + if c.SkipRegionValidation { + log.Println("[INFO] Skipping region validation") + } else { + log.Println("[INFO] Building AWS region structure") + err := c.ValidateRegion() + if err != nil { + return nil, err + } } var client AWSClient diff --git a/builtin/providers/aws/provider.go b/builtin/providers/aws/provider.go index 390d17e2c..101a67233 100644 --- a/builtin/providers/aws/provider.go +++ b/builtin/providers/aws/provider.go @@ -120,6 +120,13 @@ func Provider() terraform.ResourceProvider { Description: descriptions["skip_credentials_validation"], }, + "skip_region_validation": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: descriptions["skip_region_validation"], + }, + "skip_requesting_account_id": { Type: schema.TypeBool, Optional: true, @@ -441,6 +448,9 @@ func init() { "skip_credentials_validation": "Skip the credentials validation via STS API. " + "Used for AWS API implementations that do not have STS available/implemented.", + "skip_region_validation": "Skip static validation of region name. " + + "Used by users of alternative AWS-like APIs or users w/ access to regions that are not public (yet).", + "skip_requesting_account_id": "Skip requesting the account ID. " + "Used for AWS API implementations that do not have IAM/STS API and/or metadata API.", @@ -475,6 +485,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { KinesisEndpoint: d.Get("kinesis_endpoint").(string), Insecure: d.Get("insecure").(bool), SkipCredsValidation: d.Get("skip_credentials_validation").(bool), + SkipRegionValidation: d.Get("skip_region_validation").(bool), SkipRequestingAccountId: d.Get("skip_requesting_account_id").(bool), SkipMetadataApiCheck: d.Get("skip_metadata_api_check").(bool), S3ForcePathStyle: d.Get("s3_force_path_style").(bool), diff --git a/website/source/docs/providers/aws/index.html.markdown b/website/source/docs/providers/aws/index.html.markdown index 1ec614186..a812348ee 100644 --- a/website/source/docs/providers/aws/index.html.markdown +++ b/website/source/docs/providers/aws/index.html.markdown @@ -188,6 +188,10 @@ The following arguments are supported in the `provider` block: validation via the STS API. Useful for AWS API implementations that do not have STS available or implemented. +* `skip_region_validation` - (Optional) Skip validation of provided region name. + Useful for AWS-like implementations that use their own region names + or to bypass the validation for regions that aren't publicly available yet. + * `skip_requesting_account_id` - (Optional) Skip requesting the account ID. Useful for AWS API implementations that do not have the IAM, STS API, or metadata API. When set to `true`, prevents you from managing