From 5c30573a63d14531fb560e140ceadac61777db19 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Sun, 10 May 2015 01:52:40 -0700 Subject: [PATCH 1/4] AWS config forced to us-east-1 in variable, not inline. There are several AWS services that are global in scope and thus need to be accessed via the us-east-1 endpoints, so we'll make the us-east-1 variant of the config available as a variable we can reuse between multiple clients as we add support for new services. --- builtin/providers/aws/config.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/builtin/providers/aws/config.go b/builtin/providers/aws/config.go index f462810fc1..5f1f18a8c5 100644 --- a/builtin/providers/aws/config.go +++ b/builtin/providers/aws/config.go @@ -106,6 +106,16 @@ func (c *Config) Client() (interface{}, error) { MaxRetries: aws.Int(c.MaxRetries), Endpoint: aws.String(c.DynamoDBEndpoint), } + // Some services exist only in us-east-1, e.g. because they manage + // resources that can span across multiple regions, or because + // signature format v4 requires region to be us-east-1 for global + // endpoints: + // http://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html + usEast1AwsConfig := &aws.Config{ + Credentials: creds, + Region: aws.String("us-east-1"), + MaxRetries: aws.Int(c.MaxRetries), + } log.Println("[INFO] Initializing DynamoDB connection") client.dynamodbconn = dynamodb.New(awsDynamoDBConfig) @@ -145,15 +155,8 @@ func (c *Config) Client() (interface{}, error) { log.Println("[INFO] Initializing EFS Connection") client.efsconn = efs.New(awsConfig) - // aws-sdk-go uses v4 for signing requests, which requires all global - // endpoints to use 'us-east-1'. - // See http://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html log.Println("[INFO] Initializing Route 53 connection") - client.r53conn = route53.New(&aws.Config{ - Credentials: creds, - Region: aws.String("us-east-1"), - MaxRetries: aws.Int(c.MaxRetries), - }) + client.r53conn = route53.New(usEast1AwsConfig) log.Println("[INFO] Initializing Elasticache Connection") client.elasticacheconn = elasticache.New(awsConfig) From 8e79f0cb3adee3ffac1ead66e677738a2d557bc0 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Sun, 10 May 2015 20:20:17 -0700 Subject: [PATCH 2/4] Prepare for adding OpsWorks resources. Here we add an OpsWorks client instance to the central client bundle and establish a new documentation section, both of which will be fleshed out in subsequent commits that add some OpsWorks resources. --- builtin/providers/aws/config.go | 5 +++++ website/source/layouts/aws.erb | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/builtin/providers/aws/config.go b/builtin/providers/aws/config.go index 5f1f18a8c5..2260a548a7 100644 --- a/builtin/providers/aws/config.go +++ b/builtin/providers/aws/config.go @@ -22,6 +22,7 @@ import ( "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/kinesis" "github.com/aws/aws-sdk-go/service/lambda" + "github.com/aws/aws-sdk-go/service/opsworks" "github.com/aws/aws-sdk-go/service/rds" "github.com/aws/aws-sdk-go/service/route53" "github.com/aws/aws-sdk-go/service/s3" @@ -61,6 +62,7 @@ type AWSClient struct { kinesisconn *kinesis.Kinesis elasticacheconn *elasticache.ElastiCache lambdaconn *lambda.Lambda + opsworksconn *opsworks.OpsWorks } // Client configures and returns a fully initialized AWSClient @@ -169,6 +171,9 @@ func (c *Config) Client() (interface{}, error) { log.Println("[INFO] Initializing CloudWatch Logs connection") client.cloudwatchlogsconn = cloudwatchlogs.New(awsConfig) + + log.Println("[INFO] Initializing OpsWorks Connection") + client.opsworksconn = opsworks.New(usEast1AwsConfig) } if len(errs) > 0 { diff --git a/website/source/layouts/aws.erb b/website/source/layouts/aws.erb index 17281a9f84..08161f0b82 100644 --- a/website/source/layouts/aws.erb +++ b/website/source/layouts/aws.erb @@ -255,6 +255,14 @@ + > + OpsWorks Resources + + + + > RDS Resources @@ -259,10 +259,50 @@ OpsWorks Resources