diff --git a/config.go b/config.go index 3efe5370684..0ad4eba98aa 100644 --- a/config.go +++ b/config.go @@ -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) diff --git a/provider.go b/provider.go index 957614d7b7b..96433c52e8a 100644 --- a/provider.go +++ b/provider.go @@ -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)))