provider/aws: add devicefarm configuration

This commit is contained in:
Daniel Schmidt 2017-05-08 17:39:02 +02:00
parent 742da65144
commit 995121f9ce
2 changed files with 18 additions and 0 deletions

View File

@ -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"
@ -94,6 +95,7 @@ type Config struct {
CloudWatchEventsEndpoint string
CloudWatchLogsEndpoint string
DynamoDBEndpoint string
DeviceFarmEndpoint string
Ec2Endpoint string
ElbEndpoint string
IamEndpoint string
@ -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
@ -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)

View File

@ -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(),
@ -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.",
@ -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)
@ -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,
@ -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)))