Skip to content

Commit

Permalink
provider/aws: add devicefarm configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed May 9, 2017
1 parent 7f3307e commit d8108b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/aws/aws-sdk-go/service/cognitoidentity"
"github.com/aws/aws-sdk-go/service/configservice"
"github.com/aws/aws-sdk-go/service/databasemigrationservice"
"github.com/aws/aws-sdk-go/service/devicefarm"
"github.com/aws/aws-sdk-go/service/directoryservice"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/ec2"
Expand Down Expand Up @@ -94,6 +95,7 @@ type Config struct {
CloudWatchEventsEndpoint string
CloudWatchLogsEndpoint string
DynamoDBEndpoint string
DeviceFarmEndpoint string
Ec2Endpoint string
ElbEndpoint string
IamEndpoint string
Expand Down Expand Up @@ -122,6 +124,7 @@ type AWSClient struct {
cloudwatcheventsconn *cloudwatchevents.CloudWatchEvents
cognitoconn *cognitoidentity.CognitoIdentity
configconn *configservice.ConfigService
devicefarmconn *devicefarm.DeviceFarm
dmsconn *databasemigrationservice.DatabaseMigrationService
dsconn *directoryservice.DirectoryService
dynamodbconn *dynamodb.DynamoDB
Expand Down Expand Up @@ -286,6 +289,10 @@ func (c *Config) Client() (interface{}, error) {
awsS3Sess := sess.Copy(&aws.Config{Endpoint: aws.String(c.S3Endpoint)})
awsSnsSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.SnsEndpoint)})
awsSqsSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.SqsEndpoint)})
awsDeviceFarmSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.DeviceFarmEndpoint)})

log.Println("[INFO] Initializing DeviceFarm SDK connection")
client.devicefarmconn = devicefarm.New(awsDeviceFarmSess)

// These two services need to be set up early so we can check on AccountID
client.iamconn = iam.New(awsIamSess)
Expand Down
11 changes: 11 additions & 0 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ func Provider() terraform.ResourceProvider {
"aws_db_parameter_group": resourceAwsDbParameterGroup(),
"aws_db_security_group": resourceAwsDbSecurityGroup(),
"aws_db_subnet_group": resourceAwsDbSubnetGroup(),
"aws_devicefarm_project": resourceAwsDevicefarmProject(),
"aws_directory_service_directory": resourceAwsDirectoryServiceDirectory(),
"aws_dms_certificate": resourceAwsDmsCertificate(),
"aws_dms_endpoint": resourceAwsDmsEndpoint(),
Expand Down Expand Up @@ -495,6 +496,8 @@ func init() {

"cloudwatchlogs_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",

"devicefarm_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",

"dynamodb_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n" +
"It's typically used to connect to dynamodb-local.",

Expand Down Expand Up @@ -597,6 +600,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config.CloudWatchEndpoint = endpoints["cloudwatch"].(string)
config.CloudWatchEventsEndpoint = endpoints["cloudwatchevents"].(string)
config.CloudWatchLogsEndpoint = endpoints["cloudwatchlogs"].(string)
config.DeviceFarmEndpoint = endpoints["devicefarm"].(string)
config.DynamoDBEndpoint = endpoints["dynamodb"].(string)
config.Ec2Endpoint = endpoints["ec2"].(string)
config.ElbEndpoint = endpoints["elb"].(string)
Expand Down Expand Up @@ -699,6 +703,12 @@ func endpointsSchema() *schema.Schema {
Default: "",
Description: descriptions["cloudformation_endpoint"],
},
"devicefarm": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: descriptions["devicefarm_endpoint"],
},
"dynamodb": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -774,6 +784,7 @@ func endpointsToHash(v interface{}) int {
buf.WriteString(fmt.Sprintf("%s-", m["cloudwatchevents"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["cloudwatchlogs"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["cloudformation"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["devicefarm"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["dynamodb"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["iam"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["ec2"].(string)))
Expand Down

0 comments on commit d8108b6

Please sign in to comment.