Merge pull request #11358 from radeksimko/f-aws-skip-region-validation
provider/aws: Allow bypassing region validation
This commit is contained in:
commit
6791735790
|
@ -92,6 +92,7 @@ type Config struct {
|
||||||
Insecure bool
|
Insecure bool
|
||||||
|
|
||||||
SkipCredsValidation bool
|
SkipCredsValidation bool
|
||||||
|
SkipRegionValidation bool
|
||||||
SkipRequestingAccountId bool
|
SkipRequestingAccountId bool
|
||||||
SkipMetadataApiCheck bool
|
SkipMetadataApiCheck bool
|
||||||
S3ForcePathStyle bool
|
S3ForcePathStyle bool
|
||||||
|
@ -153,10 +154,14 @@ type AWSClient struct {
|
||||||
func (c *Config) Client() (interface{}, error) {
|
func (c *Config) Client() (interface{}, error) {
|
||||||
// Get the auth and region. This can fail if keys/regions were not
|
// Get the auth and region. This can fail if keys/regions were not
|
||||||
// specified and we're attempting to use the environment.
|
// specified and we're attempting to use the environment.
|
||||||
log.Println("[INFO] Building AWS region structure")
|
if c.SkipRegionValidation {
|
||||||
err := c.ValidateRegion()
|
log.Println("[INFO] Skipping region validation")
|
||||||
if err != nil {
|
} else {
|
||||||
return nil, err
|
log.Println("[INFO] Building AWS region structure")
|
||||||
|
err := c.ValidateRegion()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var client AWSClient
|
var client AWSClient
|
||||||
|
|
|
@ -120,6 +120,13 @@ func Provider() terraform.ResourceProvider {
|
||||||
Description: descriptions["skip_credentials_validation"],
|
Description: descriptions["skip_credentials_validation"],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"skip_region_validation": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Default: false,
|
||||||
|
Description: descriptions["skip_region_validation"],
|
||||||
|
},
|
||||||
|
|
||||||
"skip_requesting_account_id": {
|
"skip_requesting_account_id": {
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -441,6 +448,9 @@ func init() {
|
||||||
"skip_credentials_validation": "Skip the credentials validation via STS API. " +
|
"skip_credentials_validation": "Skip the credentials validation via STS API. " +
|
||||||
"Used for AWS API implementations that do not have STS available/implemented.",
|
"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. " +
|
"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.",
|
"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),
|
KinesisEndpoint: d.Get("kinesis_endpoint").(string),
|
||||||
Insecure: d.Get("insecure").(bool),
|
Insecure: d.Get("insecure").(bool),
|
||||||
SkipCredsValidation: d.Get("skip_credentials_validation").(bool),
|
SkipCredsValidation: d.Get("skip_credentials_validation").(bool),
|
||||||
|
SkipRegionValidation: d.Get("skip_region_validation").(bool),
|
||||||
SkipRequestingAccountId: d.Get("skip_requesting_account_id").(bool),
|
SkipRequestingAccountId: d.Get("skip_requesting_account_id").(bool),
|
||||||
SkipMetadataApiCheck: d.Get("skip_metadata_api_check").(bool),
|
SkipMetadataApiCheck: d.Get("skip_metadata_api_check").(bool),
|
||||||
S3ForcePathStyle: d.Get("s3_force_path_style").(bool),
|
S3ForcePathStyle: d.Get("s3_force_path_style").(bool),
|
||||||
|
|
|
@ -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
|
validation via the STS API. Useful for AWS API implementations that do
|
||||||
not have STS available or implemented.
|
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
|
* `skip_requesting_account_id` - (Optional) Skip requesting the account
|
||||||
ID. Useful for AWS API implementations that do not have the IAM, STS
|
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
|
API, or metadata API. When set to `true`, prevents you from managing
|
||||||
|
|
Loading…
Reference in New Issue