From 0ab3bc4105a70ea34586506778fb86e7b503f0ce Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Wed, 10 Aug 2016 16:46:02 +0100 Subject: [PATCH] aws: Change field names + desc according to reality - skip_iam_creds_validation => skip_credentials_validation - skip_iam_account_id => skip_requesting_account_id --- builtin/providers/aws/config.go | 25 +++++++++--------- builtin/providers/aws/provider.go | 42 +++++++++++++++---------------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/builtin/providers/aws/config.go b/builtin/providers/aws/config.go index 1a7a05c94..b0afbb65b 100644 --- a/builtin/providers/aws/config.go +++ b/builtin/providers/aws/config.go @@ -70,16 +70,17 @@ type Config struct { AllowedAccountIds []interface{} ForbiddenAccountIds []interface{} - DynamoDBEndpoint string - KinesisEndpoint string - Ec2Endpoint string - IamEndpoint string - ElbEndpoint string - S3Endpoint string - Insecure bool - SkipIamCredsValidation bool - SkipIamAccountId bool - SkipMetadataApiCheck bool + DynamoDBEndpoint string + KinesisEndpoint string + Ec2Endpoint string + IamEndpoint string + ElbEndpoint string + S3Endpoint string + Insecure bool + + SkipCredsValidation bool + SkipRequestingAccountId bool + SkipMetadataApiCheck bool } type AWSClient struct { @@ -203,7 +204,7 @@ func (c *Config) Client() (interface{}, error) { client.iamconn = iam.New(awsIamSess) client.stsconn = sts.New(sess) - if !c.SkipIamCredsValidation { + if !c.SkipCredsValidation { err = c.ValidateCredentials(client.stsconn) if err != nil { errs = append(errs, err) @@ -211,7 +212,7 @@ func (c *Config) Client() (interface{}, error) { } } - if !c.SkipIamAccountId { + if !c.SkipRequestingAccountId { accountId, err := GetAccountId(client.iamconn, client.stsconn, cp.ProviderName) if err == nil { client.accountid = accountId diff --git a/builtin/providers/aws/provider.go b/builtin/providers/aws/provider.go index af041e44e..fb1a53ba7 100644 --- a/builtin/providers/aws/provider.go +++ b/builtin/providers/aws/provider.go @@ -110,18 +110,18 @@ func Provider() terraform.ResourceProvider { Description: descriptions["insecure"], }, - "skip_iam_creds_validation": &schema.Schema{ + "skip_credentials_validation": &schema.Schema{ Type: schema.TypeBool, Optional: true, Default: false, - Description: descriptions["skip_iam_creds_validation"], + Description: descriptions["skip_credentials_validation"], }, - "skip_iam_account_id": &schema.Schema{ + "skip_requesting_account_id": &schema.Schema{ Type: schema.TypeBool, Optional: true, Default: false, - Description: descriptions["skip_iam_account_id"], + Description: descriptions["skip_requesting_account_id"], }, "skip_metadata_api_check": &schema.Schema{ @@ -355,11 +355,11 @@ func init() { "insecure": "Explicitly allow the provider to perform \"insecure\" SSL requests. If omitted," + "default value is `false`", - "skip_iam_creds_validation": "Skip the IAM/STS credentials validation. " + - "Used for AWS API implementations that do not use IAM.", + "skip_credentials_validation": "Skip the credentials validation via STS API. " + + "Used for AWS API implementations that do not have STS available/implemented.", - "skip_iam_account_id": "Skip the request of account id to IAM/STS. " + - "Used for AWS API implementations that do not use IAM.", + "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.", "skip_medatadata_api_check": "Skip the AWS Metadata API check. " + "Used for AWS API implementations that do not have a metadata api endpoint.", @@ -368,19 +368,19 @@ func init() { func providerConfigure(d *schema.ResourceData) (interface{}, error) { config := Config{ - AccessKey: d.Get("access_key").(string), - SecretKey: d.Get("secret_key").(string), - Profile: d.Get("profile").(string), - CredsFilename: d.Get("shared_credentials_file").(string), - Token: d.Get("token").(string), - Region: d.Get("region").(string), - MaxRetries: d.Get("max_retries").(int), - DynamoDBEndpoint: d.Get("dynamodb_endpoint").(string), - KinesisEndpoint: d.Get("kinesis_endpoint").(string), - Insecure: d.Get("insecure").(bool), - SkipIamCredsValidation: d.Get("skip_iam_creds_validation").(bool), - SkipIamAccountId: d.Get("skip_iam_account_id").(bool), - SkipMetadataApiCheck: d.Get("skip_metadata_api_check").(bool), + AccessKey: d.Get("access_key").(string), + SecretKey: d.Get("secret_key").(string), + Profile: d.Get("profile").(string), + CredsFilename: d.Get("shared_credentials_file").(string), + Token: d.Get("token").(string), + Region: d.Get("region").(string), + MaxRetries: d.Get("max_retries").(int), + DynamoDBEndpoint: d.Get("dynamodb_endpoint").(string), + KinesisEndpoint: d.Get("kinesis_endpoint").(string), + Insecure: d.Get("insecure").(bool), + SkipCredsValidation: d.Get("skip_credentials_validation").(bool), + SkipRequestingAccountId: d.Get("skip_requesting_account_id").(bool), + SkipMetadataApiCheck: d.Get("skip_metadata_api_check").(bool), } endpointsSet := d.Get("endpoints").(*schema.Set)