2014-08-20 00:40:48 +02:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import (
|
2016-02-07 22:40:51 +01:00
|
|
|
"bytes"
|
|
|
|
"fmt"
|
2016-09-02 19:36:01 +02:00
|
|
|
"log"
|
2016-02-07 22:40:51 +01:00
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/helper/hashcode"
|
2015-08-24 15:59:54 +02:00
|
|
|
"github.com/hashicorp/terraform/helper/mutexkv"
|
2014-08-20 00:40:48 +02:00
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
2014-11-24 14:04:48 +01:00
|
|
|
"github.com/hashicorp/terraform/terraform"
|
2014-08-20 00:40:48 +02:00
|
|
|
)
|
|
|
|
|
2014-11-24 14:04:48 +01:00
|
|
|
// Provider returns a terraform.ResourceProvider.
|
|
|
|
func Provider() terraform.ResourceProvider {
|
2014-08-20 00:40:48 +02:00
|
|
|
// TODO: Move the validation to this, requires conditional schemas
|
|
|
|
// TODO: Move the configuration to this, requires validation
|
|
|
|
|
2015-06-29 07:46:49 +02:00
|
|
|
// The actual provider
|
2014-08-20 00:40:48 +02:00
|
|
|
return &schema.Provider{
|
2014-09-10 06:44:31 +02:00
|
|
|
Schema: map[string]*schema.Schema{
|
2016-09-02 19:29:59 +02:00
|
|
|
"access_key": {
|
2015-12-10 22:43:13 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
2014-09-29 22:30:28 +02:00
|
|
|
Description: descriptions["access_key"],
|
2014-09-10 06:44:31 +02:00
|
|
|
},
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"secret_key": {
|
2015-12-10 22:43:13 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
2014-09-29 22:30:28 +02:00
|
|
|
Description: descriptions["secret_key"],
|
2014-09-10 06:44:31 +02:00
|
|
|
},
|
2014-11-21 17:58:34 +01:00
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"profile": {
|
2016-01-11 16:22:09 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
|
|
|
Description: descriptions["profile"],
|
|
|
|
},
|
|
|
|
|
2016-09-02 19:36:01 +02:00
|
|
|
"assume_role": assumeRoleSchema(),
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"shared_credentials_file": {
|
2016-01-11 16:22:09 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
|
|
|
Description: descriptions["shared_credentials_file"],
|
|
|
|
},
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"token": {
|
2015-12-10 22:43:13 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
2015-04-20 20:26:59 +02:00
|
|
|
Description: descriptions["token"],
|
|
|
|
},
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"region": {
|
2015-01-22 21:30:27 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Required: true,
|
|
|
|
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
|
|
|
|
"AWS_REGION",
|
|
|
|
"AWS_DEFAULT_REGION",
|
|
|
|
}, nil),
|
2014-11-21 17:58:34 +01:00
|
|
|
Description: descriptions["region"],
|
|
|
|
InputDefault: "us-east-1",
|
|
|
|
},
|
2015-04-20 00:54:42 +02:00
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"max_retries": {
|
2015-05-03 11:08:47 +02:00
|
|
|
Type: schema.TypeInt,
|
|
|
|
Optional: true,
|
|
|
|
Default: 11,
|
|
|
|
Description: descriptions["max_retries"],
|
|
|
|
},
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"allowed_account_ids": {
|
2015-04-20 00:54:42 +02:00
|
|
|
Type: schema.TypeSet,
|
|
|
|
Elem: &schema.Schema{Type: schema.TypeString},
|
|
|
|
Optional: true,
|
|
|
|
ConflictsWith: []string{"forbidden_account_ids"},
|
2016-02-08 00:51:26 +01:00
|
|
|
Set: schema.HashString,
|
2015-04-20 00:54:42 +02:00
|
|
|
},
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"forbidden_account_ids": {
|
2015-04-20 00:54:42 +02:00
|
|
|
Type: schema.TypeSet,
|
|
|
|
Elem: &schema.Schema{Type: schema.TypeString},
|
|
|
|
Optional: true,
|
|
|
|
ConflictsWith: []string{"allowed_account_ids"},
|
2016-02-08 00:51:26 +01:00
|
|
|
Set: schema.HashString,
|
2015-04-20 00:54:42 +02:00
|
|
|
},
|
2015-07-22 23:57:29 +02:00
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"dynamodb_endpoint": {
|
2015-07-22 23:57:29 +02:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
|
|
|
Description: descriptions["dynamodb_endpoint"],
|
|
|
|
},
|
2015-09-16 18:58:46 +02:00
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"kinesis_endpoint": {
|
2015-09-16 18:58:46 +02:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
|
|
|
Description: descriptions["kinesis_endpoint"],
|
|
|
|
},
|
2016-08-10 16:10:34 +02:00
|
|
|
|
2016-02-07 22:40:51 +01:00
|
|
|
"endpoints": endpointsSchema(),
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"insecure": {
|
2016-02-07 22:40:51 +01:00
|
|
|
Type: schema.TypeBool,
|
|
|
|
Optional: true,
|
|
|
|
Default: false,
|
|
|
|
Description: descriptions["insecure"],
|
|
|
|
},
|
2016-08-10 16:10:34 +02:00
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"skip_credentials_validation": {
|
2016-08-10 16:10:34 +02:00
|
|
|
Type: schema.TypeBool,
|
|
|
|
Optional: true,
|
|
|
|
Default: false,
|
2016-08-10 17:46:02 +02:00
|
|
|
Description: descriptions["skip_credentials_validation"],
|
2016-08-10 16:10:34 +02:00
|
|
|
},
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"skip_requesting_account_id": {
|
2016-08-10 16:10:34 +02:00
|
|
|
Type: schema.TypeBool,
|
|
|
|
Optional: true,
|
|
|
|
Default: false,
|
2016-08-10 17:46:02 +02:00
|
|
|
Description: descriptions["skip_requesting_account_id"],
|
2016-08-10 16:10:34 +02:00
|
|
|
},
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"skip_metadata_api_check": {
|
2016-08-10 16:10:34 +02:00
|
|
|
Type: schema.TypeBool,
|
|
|
|
Optional: true,
|
|
|
|
Default: false,
|
|
|
|
Description: descriptions["skip_metadata_api_check"],
|
|
|
|
},
|
2016-08-12 18:52:12 +02:00
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"s3_force_path_style": {
|
2016-08-12 18:52:12 +02:00
|
|
|
Type: schema.TypeBool,
|
|
|
|
Optional: true,
|
|
|
|
Default: false,
|
|
|
|
Description: descriptions["s3_force_path_style"],
|
|
|
|
},
|
2014-09-10 06:44:31 +02:00
|
|
|
},
|
|
|
|
|
2016-05-14 20:18:51 +02:00
|
|
|
DataSourcesMap: map[string]*schema.Resource{
|
2016-06-15 19:55:45 +02:00
|
|
|
"aws_ami": dataSourceAwsAmi(),
|
2016-05-22 19:21:02 +02:00
|
|
|
"aws_availability_zone": dataSourceAwsAvailabilityZone(),
|
2016-06-15 19:55:45 +02:00
|
|
|
"aws_availability_zones": dataSourceAwsAvailabilityZones(),
|
2016-09-07 07:43:45 +02:00
|
|
|
"aws_billing_service_account": dataSourceAwsBillingServiceAccount(),
|
2016-08-15 23:43:24 +02:00
|
|
|
"aws_caller_identity": dataSourceAwsCallerIdentity(),
|
2016-06-02 11:08:12 +02:00
|
|
|
"aws_cloudformation_stack": dataSourceAwsCloudFormationStack(),
|
2016-08-16 18:58:46 +02:00
|
|
|
"aws_ecs_container_definition": dataSourceAwsEcsContainerDefinition(),
|
2016-08-16 22:05:27 +02:00
|
|
|
"aws_elb_service_account": dataSourceAwsElbServiceAccount(),
|
2016-06-15 19:55:45 +02:00
|
|
|
"aws_iam_policy_document": dataSourceAwsIamPolicyDocument(),
|
2016-08-04 19:20:14 +02:00
|
|
|
"aws_ip_ranges": dataSourceAwsIPRanges(),
|
2016-10-27 15:58:24 +02:00
|
|
|
"aws_prefix_list": dataSourceAwsPrefixList(),
|
2016-08-16 18:58:46 +02:00
|
|
|
"aws_redshift_service_account": dataSourceAwsRedshiftServiceAccount(),
|
2016-05-22 19:22:09 +02:00
|
|
|
"aws_region": dataSourceAwsRegion(),
|
2016-06-15 19:55:45 +02:00
|
|
|
"aws_s3_bucket_object": dataSourceAwsS3BucketObject(),
|
2016-05-22 17:23:25 +02:00
|
|
|
"aws_subnet": dataSourceAwsSubnet(),
|
2016-10-27 19:17:58 +02:00
|
|
|
"aws_security_group": dataSourceAwsSecurityGroup(),
|
2016-05-22 17:25:30 +02:00
|
|
|
"aws_vpc": dataSourceAwsVpc(),
|
2016-05-14 20:18:51 +02:00
|
|
|
},
|
|
|
|
|
2014-08-20 01:56:23 +02:00
|
|
|
ResourcesMap: map[string]*schema.Resource{
|
2016-08-15 23:09:40 +02:00
|
|
|
"aws_alb": resourceAwsAlb(),
|
2016-08-17 19:42:18 +02:00
|
|
|
"aws_alb_listener": resourceAwsAlbListener(),
|
2016-08-19 00:43:11 +02:00
|
|
|
"aws_alb_listener_rule": resourceAwsAlbListenerRule(),
|
2016-08-15 23:10:54 +02:00
|
|
|
"aws_alb_target_group": resourceAwsAlbTargetGroup(),
|
2016-08-19 17:12:19 +02:00
|
|
|
"aws_alb_target_group_attachment": resourceAwsAlbTargetGroupAttachment(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_ami": resourceAwsAmi(),
|
|
|
|
"aws_ami_copy": resourceAwsAmiCopy(),
|
|
|
|
"aws_ami_from_instance": resourceAwsAmiFromInstance(),
|
2016-07-22 00:08:32 +02:00
|
|
|
"aws_ami_launch_permission": resourceAwsAmiLaunchPermission(),
|
2016-04-27 14:08:59 +02:00
|
|
|
"aws_api_gateway_account": resourceAwsApiGatewayAccount(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_api_gateway_api_key": resourceAwsApiGatewayApiKey(),
|
2016-04-25 13:22:37 +02:00
|
|
|
"aws_api_gateway_authorizer": resourceAwsApiGatewayAuthorizer(),
|
2016-08-21 22:41:59 +02:00
|
|
|
"aws_api_gateway_base_path_mapping": resourceAwsApiGatewayBasePathMapping(),
|
2016-09-11 16:14:10 +02:00
|
|
|
"aws_api_gateway_client_certificate": resourceAwsApiGatewayClientCertificate(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_api_gateway_deployment": resourceAwsApiGatewayDeployment(),
|
2016-08-21 18:19:48 +02:00
|
|
|
"aws_api_gateway_domain_name": resourceAwsApiGatewayDomainName(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_api_gateway_integration": resourceAwsApiGatewayIntegration(),
|
|
|
|
"aws_api_gateway_integration_response": resourceAwsApiGatewayIntegrationResponse(),
|
|
|
|
"aws_api_gateway_method": resourceAwsApiGatewayMethod(),
|
|
|
|
"aws_api_gateway_method_response": resourceAwsApiGatewayMethodResponse(),
|
|
|
|
"aws_api_gateway_model": resourceAwsApiGatewayModel(),
|
|
|
|
"aws_api_gateway_resource": resourceAwsApiGatewayResource(),
|
|
|
|
"aws_api_gateway_rest_api": resourceAwsApiGatewayRestApi(),
|
|
|
|
"aws_app_cookie_stickiness_policy": resourceAwsAppCookieStickinessPolicy(),
|
2016-07-15 13:54:36 +02:00
|
|
|
"aws_appautoscaling_target": resourceAwsAppautoscalingTarget(),
|
|
|
|
"aws_appautoscaling_policy": resourceAwsAppautoscalingPolicy(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_autoscaling_group": resourceAwsAutoscalingGroup(),
|
|
|
|
"aws_autoscaling_notification": resourceAwsAutoscalingNotification(),
|
|
|
|
"aws_autoscaling_policy": resourceAwsAutoscalingPolicy(),
|
|
|
|
"aws_autoscaling_schedule": resourceAwsAutoscalingSchedule(),
|
|
|
|
"aws_cloudformation_stack": resourceAwsCloudFormationStack(),
|
2016-04-14 21:55:11 +02:00
|
|
|
"aws_cloudfront_distribution": resourceAwsCloudFrontDistribution(),
|
|
|
|
"aws_cloudfront_origin_access_identity": resourceAwsCloudFrontOriginAccessIdentity(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_cloudtrail": resourceAwsCloudTrail(),
|
|
|
|
"aws_cloudwatch_event_rule": resourceAwsCloudWatchEventRule(),
|
|
|
|
"aws_cloudwatch_event_target": resourceAwsCloudWatchEventTarget(),
|
|
|
|
"aws_cloudwatch_log_group": resourceAwsCloudWatchLogGroup(),
|
2016-02-29 14:07:45 +01:00
|
|
|
"aws_cloudwatch_log_metric_filter": resourceAwsCloudWatchLogMetricFilter(),
|
2016-09-02 13:29:48 +02:00
|
|
|
"aws_cloudwatch_log_stream": resourceAwsCloudWatchLogStream(),
|
2016-04-20 21:05:21 +02:00
|
|
|
"aws_cloudwatch_log_subscription_filter": resourceAwsCloudwatchLogSubscriptionFilter(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_autoscaling_lifecycle_hook": resourceAwsAutoscalingLifecycleHook(),
|
|
|
|
"aws_cloudwatch_metric_alarm": resourceAwsCloudWatchMetricAlarm(),
|
|
|
|
"aws_codedeploy_app": resourceAwsCodeDeployApp(),
|
|
|
|
"aws_codedeploy_deployment_group": resourceAwsCodeDeployDeploymentGroup(),
|
|
|
|
"aws_codecommit_repository": resourceAwsCodeCommitRepository(),
|
2016-09-08 10:54:54 +02:00
|
|
|
"aws_codecommit_trigger": resourceAwsCodeCommitTrigger(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_customer_gateway": resourceAwsCustomerGateway(),
|
2016-05-05 12:14:25 +02:00
|
|
|
"aws_db_event_subscription": resourceAwsDbEventSubscription(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_db_instance": resourceAwsDbInstance(),
|
2015-12-21 10:15:52 +01:00
|
|
|
"aws_db_option_group": resourceAwsDbOptionGroup(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_db_parameter_group": resourceAwsDbParameterGroup(),
|
|
|
|
"aws_db_security_group": resourceAwsDbSecurityGroup(),
|
|
|
|
"aws_db_subnet_group": resourceAwsDbSubnetGroup(),
|
|
|
|
"aws_directory_service_directory": resourceAwsDirectoryServiceDirectory(),
|
|
|
|
"aws_dynamodb_table": resourceAwsDynamoDbTable(),
|
|
|
|
"aws_ebs_volume": resourceAwsEbsVolume(),
|
|
|
|
"aws_ecr_repository": resourceAwsEcrRepository(),
|
|
|
|
"aws_ecr_repository_policy": resourceAwsEcrRepositoryPolicy(),
|
|
|
|
"aws_ecs_cluster": resourceAwsEcsCluster(),
|
|
|
|
"aws_ecs_service": resourceAwsEcsService(),
|
|
|
|
"aws_ecs_task_definition": resourceAwsEcsTaskDefinition(),
|
|
|
|
"aws_efs_file_system": resourceAwsEfsFileSystem(),
|
|
|
|
"aws_efs_mount_target": resourceAwsEfsMountTarget(),
|
|
|
|
"aws_eip": resourceAwsEip(),
|
2016-05-09 19:40:45 +02:00
|
|
|
"aws_eip_association": resourceAwsEipAssociation(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_elasticache_cluster": resourceAwsElasticacheCluster(),
|
|
|
|
"aws_elasticache_parameter_group": resourceAwsElasticacheParameterGroup(),
|
2016-08-18 20:42:29 +02:00
|
|
|
"aws_elasticache_replication_group": resourceAwsElasticacheReplicationGroup(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_elasticache_security_group": resourceAwsElasticacheSecurityGroup(),
|
|
|
|
"aws_elasticache_subnet_group": resourceAwsElasticacheSubnetGroup(),
|
|
|
|
"aws_elastic_beanstalk_application": resourceAwsElasticBeanstalkApplication(),
|
|
|
|
"aws_elastic_beanstalk_configuration_template": resourceAwsElasticBeanstalkConfigurationTemplate(),
|
|
|
|
"aws_elastic_beanstalk_environment": resourceAwsElasticBeanstalkEnvironment(),
|
|
|
|
"aws_elasticsearch_domain": resourceAwsElasticSearchDomain(),
|
2016-05-27 00:29:42 +02:00
|
|
|
"aws_elastictranscoder_pipeline": resourceAwsElasticTranscoderPipeline(),
|
|
|
|
"aws_elastictranscoder_preset": resourceAwsElasticTranscoderPreset(),
|
2016-09-22 21:59:13 +02:00
|
|
|
"aws_elb": resourceAwsElb(),
|
|
|
|
"aws_elb_attachment": resourceAwsElbAttachment(),
|
|
|
|
"aws_emr_cluster": resourceAwsEMRCluster(),
|
|
|
|
"aws_emr_instance_group": resourceAwsEMRInstanceGroup(),
|
|
|
|
"aws_flow_log": resourceAwsFlowLog(),
|
|
|
|
"aws_glacier_vault": resourceAwsGlacierVault(),
|
|
|
|
"aws_iam_access_key": resourceAwsIamAccessKey(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_iam_account_password_policy": resourceAwsIamAccountPasswordPolicy(),
|
|
|
|
"aws_iam_group_policy": resourceAwsIamGroupPolicy(),
|
|
|
|
"aws_iam_group": resourceAwsIamGroup(),
|
|
|
|
"aws_iam_group_membership": resourceAwsIamGroupMembership(),
|
2016-05-25 18:03:43 +02:00
|
|
|
"aws_iam_group_policy_attachment": resourceAwsIamGroupPolicyAttachment(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_iam_instance_profile": resourceAwsIamInstanceProfile(),
|
|
|
|
"aws_iam_policy": resourceAwsIamPolicy(),
|
|
|
|
"aws_iam_policy_attachment": resourceAwsIamPolicyAttachment(),
|
2016-05-25 18:03:43 +02:00
|
|
|
"aws_iam_role_policy_attachment": resourceAwsIamRolePolicyAttachment(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_iam_role_policy": resourceAwsIamRolePolicy(),
|
|
|
|
"aws_iam_role": resourceAwsIamRole(),
|
|
|
|
"aws_iam_saml_provider": resourceAwsIamSamlProvider(),
|
|
|
|
"aws_iam_server_certificate": resourceAwsIAMServerCertificate(),
|
2016-05-25 18:03:43 +02:00
|
|
|
"aws_iam_user_policy_attachment": resourceAwsIamUserPolicyAttachment(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_iam_user_policy": resourceAwsIamUserPolicy(),
|
2016-03-22 02:19:16 +01:00
|
|
|
"aws_iam_user_ssh_key": resourceAwsIamUserSshKey(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_iam_user": resourceAwsIamUser(),
|
2016-10-25 17:33:42 +02:00
|
|
|
"aws_iam_user_login_profile": resourceAwsIamUserLoginProfile(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_instance": resourceAwsInstance(),
|
|
|
|
"aws_internet_gateway": resourceAwsInternetGateway(),
|
|
|
|
"aws_key_pair": resourceAwsKeyPair(),
|
|
|
|
"aws_kinesis_firehose_delivery_stream": resourceAwsKinesisFirehoseDeliveryStream(),
|
|
|
|
"aws_kinesis_stream": resourceAwsKinesisStream(),
|
2015-09-09 17:58:24 +02:00
|
|
|
"aws_kms_alias": resourceAwsKmsAlias(),
|
|
|
|
"aws_kms_key": resourceAwsKmsKey(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_lambda_function": resourceAwsLambdaFunction(),
|
|
|
|
"aws_lambda_event_source_mapping": resourceAwsLambdaEventSourceMapping(),
|
|
|
|
"aws_lambda_alias": resourceAwsLambdaAlias(),
|
|
|
|
"aws_lambda_permission": resourceAwsLambdaPermission(),
|
|
|
|
"aws_launch_configuration": resourceAwsLaunchConfiguration(),
|
|
|
|
"aws_lb_cookie_stickiness_policy": resourceAwsLBCookieStickinessPolicy(),
|
2016-08-08 04:34:26 +02:00
|
|
|
"aws_load_balancer_policy": resourceAwsLoadBalancerPolicy(),
|
|
|
|
"aws_load_balancer_backend_server_policy": resourceAwsLoadBalancerBackendServerPolicies(),
|
|
|
|
"aws_load_balancer_listener_policy": resourceAwsLoadBalancerListenerPolicies(),
|
2016-03-15 05:13:44 +01:00
|
|
|
"aws_lb_ssl_negotiation_policy": resourceAwsLBSSLNegotiationPolicy(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_main_route_table_association": resourceAwsMainRouteTableAssociation(),
|
|
|
|
"aws_nat_gateway": resourceAwsNatGateway(),
|
|
|
|
"aws_network_acl": resourceAwsNetworkAcl(),
|
2016-04-18 18:02:00 +02:00
|
|
|
"aws_default_network_acl": resourceAwsDefaultNetworkAcl(),
|
2016-08-25 23:02:44 +02:00
|
|
|
"aws_default_route_table": resourceAwsDefaultRouteTable(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_network_acl_rule": resourceAwsNetworkAclRule(),
|
|
|
|
"aws_network_interface": resourceAwsNetworkInterface(),
|
2015-12-22 17:45:27 +01:00
|
|
|
"aws_opsworks_application": resourceAwsOpsworksApplication(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_opsworks_stack": resourceAwsOpsworksStack(),
|
|
|
|
"aws_opsworks_java_app_layer": resourceAwsOpsworksJavaAppLayer(),
|
|
|
|
"aws_opsworks_haproxy_layer": resourceAwsOpsworksHaproxyLayer(),
|
|
|
|
"aws_opsworks_static_web_layer": resourceAwsOpsworksStaticWebLayer(),
|
|
|
|
"aws_opsworks_php_app_layer": resourceAwsOpsworksPhpAppLayer(),
|
|
|
|
"aws_opsworks_rails_app_layer": resourceAwsOpsworksRailsAppLayer(),
|
|
|
|
"aws_opsworks_nodejs_app_layer": resourceAwsOpsworksNodejsAppLayer(),
|
|
|
|
"aws_opsworks_memcached_layer": resourceAwsOpsworksMemcachedLayer(),
|
|
|
|
"aws_opsworks_mysql_layer": resourceAwsOpsworksMysqlLayer(),
|
|
|
|
"aws_opsworks_ganglia_layer": resourceAwsOpsworksGangliaLayer(),
|
|
|
|
"aws_opsworks_custom_layer": resourceAwsOpsworksCustomLayer(),
|
2015-12-12 00:35:22 +01:00
|
|
|
"aws_opsworks_instance": resourceAwsOpsworksInstance(),
|
2016-07-21 01:29:33 +02:00
|
|
|
"aws_opsworks_user_profile": resourceAwsOpsworksUserProfile(),
|
|
|
|
"aws_opsworks_permission": resourceAwsOpsworksPermission(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_placement_group": resourceAwsPlacementGroup(),
|
|
|
|
"aws_proxy_protocol_policy": resourceAwsProxyProtocolPolicy(),
|
|
|
|
"aws_rds_cluster": resourceAwsRDSCluster(),
|
|
|
|
"aws_rds_cluster_instance": resourceAwsRDSClusterInstance(),
|
2016-02-23 11:52:07 +01:00
|
|
|
"aws_rds_cluster_parameter_group": resourceAwsRDSClusterParameterGroup(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_redshift_cluster": resourceAwsRedshiftCluster(),
|
|
|
|
"aws_redshift_security_group": resourceAwsRedshiftSecurityGroup(),
|
|
|
|
"aws_redshift_parameter_group": resourceAwsRedshiftParameterGroup(),
|
|
|
|
"aws_redshift_subnet_group": resourceAwsRedshiftSubnetGroup(),
|
|
|
|
"aws_route53_delegation_set": resourceAwsRoute53DelegationSet(),
|
|
|
|
"aws_route53_record": resourceAwsRoute53Record(),
|
|
|
|
"aws_route53_zone_association": resourceAwsRoute53ZoneAssociation(),
|
|
|
|
"aws_route53_zone": resourceAwsRoute53Zone(),
|
|
|
|
"aws_route53_health_check": resourceAwsRoute53HealthCheck(),
|
|
|
|
"aws_route": resourceAwsRoute(),
|
|
|
|
"aws_route_table": resourceAwsRouteTable(),
|
|
|
|
"aws_route_table_association": resourceAwsRouteTableAssociation(),
|
2016-06-26 23:07:14 +02:00
|
|
|
"aws_ses_active_receipt_rule_set": resourceAwsSesActiveReceiptRuleSet(),
|
|
|
|
"aws_ses_receipt_filter": resourceAwsSesReceiptFilter(),
|
|
|
|
"aws_ses_receipt_rule": resourceAwsSesReceiptRule(),
|
|
|
|
"aws_ses_receipt_rule_set": resourceAwsSesReceiptRuleSet(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_s3_bucket": resourceAwsS3Bucket(),
|
2016-09-02 00:34:45 +02:00
|
|
|
"aws_s3_bucket_policy": resourceAwsS3BucketPolicy(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_s3_bucket_object": resourceAwsS3BucketObject(),
|
2016-04-05 04:23:06 +02:00
|
|
|
"aws_s3_bucket_notification": resourceAwsS3BucketNotification(),
|
2016-09-15 20:59:20 +02:00
|
|
|
"aws_default_security_group": resourceAwsDefaultSecurityGroup(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_security_group": resourceAwsSecurityGroup(),
|
|
|
|
"aws_security_group_rule": resourceAwsSecurityGroupRule(),
|
2016-07-12 13:55:58 +02:00
|
|
|
"aws_simpledb_domain": resourceAwsSimpleDBDomain(),
|
2016-10-28 11:59:12 +02:00
|
|
|
"aws_ssm_activation": resourceAwsSsmActivation(),
|
2016-09-02 09:43:03 +02:00
|
|
|
"aws_ssm_association": resourceAwsSsmAssociation(),
|
2016-08-25 10:47:24 +02:00
|
|
|
"aws_ssm_document": resourceAwsSsmDocument(),
|
2016-08-24 11:51:57 +02:00
|
|
|
"aws_spot_datafeed_subscription": resourceAwsSpotDataFeedSubscription(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_spot_instance_request": resourceAwsSpotInstanceRequest(),
|
2016-06-22 02:16:02 +02:00
|
|
|
"aws_spot_fleet_request": resourceAwsSpotFleetRequest(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_sqs_queue": resourceAwsSqsQueue(),
|
2016-09-05 08:45:04 +02:00
|
|
|
"aws_sqs_queue_policy": resourceAwsSqsQueuePolicy(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_sns_topic": resourceAwsSnsTopic(),
|
2016-09-04 09:30:10 +02:00
|
|
|
"aws_sns_topic_policy": resourceAwsSnsTopicPolicy(),
|
2016-03-07 21:42:30 +01:00
|
|
|
"aws_sns_topic_subscription": resourceAwsSnsTopicSubscription(),
|
|
|
|
"aws_subnet": resourceAwsSubnet(),
|
|
|
|
"aws_volume_attachment": resourceAwsVolumeAttachment(),
|
|
|
|
"aws_vpc_dhcp_options_association": resourceAwsVpcDhcpOptionsAssociation(),
|
|
|
|
"aws_vpc_dhcp_options": resourceAwsVpcDhcpOptions(),
|
|
|
|
"aws_vpc_peering_connection": resourceAwsVpcPeeringConnection(),
|
|
|
|
"aws_vpc": resourceAwsVpc(),
|
|
|
|
"aws_vpc_endpoint": resourceAwsVpcEndpoint(),
|
|
|
|
"aws_vpn_connection": resourceAwsVpnConnection(),
|
|
|
|
"aws_vpn_connection_route": resourceAwsVpnConnectionRoute(),
|
|
|
|
"aws_vpn_gateway": resourceAwsVpnGateway(),
|
2016-08-07 01:29:51 +02:00
|
|
|
"aws_vpn_gateway_attachment": resourceAwsVpnGatewayAttachment(),
|
2016-10-28 14:36:16 +02:00
|
|
|
"aws_waf_byte_match_set": resourceAwsWafByteMatchSet(),
|
2016-10-27 13:54:36 +02:00
|
|
|
"aws_waf_ipset": resourceAwsWafIPSet(),
|
2016-10-29 00:58:37 +02:00
|
|
|
"aws_waf_rule": resourceAwsWafRule(),
|
|
|
|
"aws_waf_size_constraint_set": resourceAwsWafSizeConstraintSet(),
|
|
|
|
"aws_waf_web_acl": resourceAwsWafWebAcl(),
|
2016-10-31 09:51:08 +01:00
|
|
|
"aws_waf_xss_match_set": resourceAwsWafXssMatchSet(),
|
2016-10-31 18:51:47 +01:00
|
|
|
"aws_waf_sql_injection_match_set": resourceAwsWafSqlInjectionMatchSet(),
|
2014-08-20 01:56:23 +02:00
|
|
|
},
|
2014-11-21 17:58:34 +01:00
|
|
|
ConfigureFunc: providerConfigure,
|
2014-09-10 06:46:50 +02:00
|
|
|
}
|
|
|
|
}
|
2014-09-29 22:30:28 +02:00
|
|
|
|
|
|
|
var descriptions map[string]string
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
descriptions = map[string]string{
|
|
|
|
"region": "The region where AWS operations will take place. Examples\n" +
|
|
|
|
"are us-east-1, us-west-2, etc.",
|
|
|
|
|
|
|
|
"access_key": "The access key for API operations. You can retrieve this\n" +
|
|
|
|
"from the 'Security & Credentials' section of the AWS console.",
|
|
|
|
|
|
|
|
"secret_key": "The secret key for API operations. You can retrieve this\n" +
|
|
|
|
"from the 'Security & Credentials' section of the AWS console.",
|
2015-04-20 20:26:59 +02:00
|
|
|
|
2016-01-11 16:22:09 +01:00
|
|
|
"profile": "The profile for API operations. If not set, the default profile\n" +
|
|
|
|
"created with `aws configure` will be used.",
|
|
|
|
|
|
|
|
"shared_credentials_file": "The path to the shared credentials file. If not set\n" +
|
|
|
|
"this defaults to ~/.aws/credentials.",
|
|
|
|
|
2015-04-20 20:26:59 +02:00
|
|
|
"token": "session token. A session token is only required if you are\n" +
|
|
|
|
"using temporary security credentials.",
|
2015-05-03 11:08:47 +02:00
|
|
|
|
|
|
|
"max_retries": "The maximum number of times an AWS API request is\n" +
|
|
|
|
"being executed. If the API request still fails, an error is\n" +
|
|
|
|
"thrown.",
|
2015-07-22 23:57:29 +02:00
|
|
|
|
2015-07-29 18:36:02 +02:00
|
|
|
"dynamodb_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n" +
|
2015-07-22 23:57:29 +02:00
|
|
|
"It's typically used to connect to dynamodb-local.",
|
2015-09-16 18:58:46 +02:00
|
|
|
|
|
|
|
"kinesis_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n" +
|
|
|
|
"It's typically used to connect to kinesalite.",
|
2015-12-11 16:27:49 +01:00
|
|
|
|
2016-02-07 22:40:51 +01:00
|
|
|
"iam_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",
|
2015-12-11 16:27:49 +01:00
|
|
|
|
2016-02-07 22:40:51 +01:00
|
|
|
"ec2_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",
|
2015-12-11 16:27:49 +01:00
|
|
|
|
2016-02-07 22:40:51 +01:00
|
|
|
"elb_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",
|
2015-12-11 16:27:49 +01:00
|
|
|
|
2016-08-12 18:52:12 +02:00
|
|
|
"s3_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",
|
|
|
|
|
2016-02-07 22:40:51 +01:00
|
|
|
"insecure": "Explicitly allow the provider to perform \"insecure\" SSL requests. If omitted," +
|
|
|
|
"default value is `false`",
|
2016-08-10 16:10:34 +02:00
|
|
|
|
2016-08-10 17:46:02 +02:00
|
|
|
"skip_credentials_validation": "Skip the credentials validation via STS API. " +
|
|
|
|
"Used for AWS API implementations that do not have STS available/implemented.",
|
2016-08-10 16:10:34 +02:00
|
|
|
|
2016-08-10 17:46:02 +02:00
|
|
|
"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.",
|
2016-08-10 16:10:34 +02:00
|
|
|
|
|
|
|
"skip_medatadata_api_check": "Skip the AWS Metadata API check. " +
|
|
|
|
"Used for AWS API implementations that do not have a metadata api endpoint.",
|
2016-08-12 18:52:12 +02:00
|
|
|
|
|
|
|
"s3_force_path_style": "Set this to true to force the request to use path-style addressing,\n" +
|
|
|
|
"i.e., http://s3.amazonaws.com/BUCKET/KEY. By default, the S3 client will\n" +
|
|
|
|
"use virtual hosted bucket addressing when possible\n" +
|
|
|
|
"(http://BUCKET.s3.amazonaws.com/KEY). Specific to the Amazon S3 service.",
|
2016-09-02 19:36:01 +02:00
|
|
|
|
|
|
|
"assume_role_role_arn": "The ARN of an IAM role to assume prior to making API calls.",
|
|
|
|
|
2016-09-12 08:14:24 +02:00
|
|
|
"assume_role_session_name": "The session name to use when assuming the role. If omitted," +
|
2016-09-02 19:36:01 +02:00
|
|
|
" no session name is passed to the AssumeRole call.",
|
|
|
|
|
2016-09-12 08:14:24 +02:00
|
|
|
"assume_role_external_id": "The external ID to use when assuming the role. If omitted," +
|
2016-09-02 19:36:01 +02:00
|
|
|
" no external ID is passed to the AssumeRole call.",
|
2014-09-29 22:30:28 +02:00
|
|
|
}
|
|
|
|
}
|
2014-11-21 17:58:34 +01:00
|
|
|
|
|
|
|
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
|
|
|
config := Config{
|
2016-08-10 17:46:02 +02:00
|
|
|
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),
|
2016-08-12 18:52:12 +02:00
|
|
|
S3ForcePathStyle: d.Get("s3_force_path_style").(bool),
|
2016-02-07 22:40:51 +01:00
|
|
|
}
|
|
|
|
|
2016-09-02 19:36:01 +02:00
|
|
|
assumeRoleList := d.Get("assume_role").(*schema.Set).List()
|
|
|
|
if len(assumeRoleList) == 1 {
|
|
|
|
assumeRole := assumeRoleList[0].(map[string]interface{})
|
|
|
|
config.AssumeRoleARN = assumeRole["role_arn"].(string)
|
|
|
|
config.AssumeRoleSessionName = assumeRole["session_name"].(string)
|
|
|
|
config.AssumeRoleExternalID = assumeRole["external_id"].(string)
|
|
|
|
log.Printf("[INFO] assume_role configuration set: (ARN: %q, SessionID: %q, ExternalID: %q)",
|
|
|
|
config.AssumeRoleARN, config.AssumeRoleSessionName, config.AssumeRoleExternalID)
|
|
|
|
} else {
|
|
|
|
log.Printf("[INFO] No assume_role block read from configuration")
|
|
|
|
}
|
|
|
|
|
2016-02-07 22:40:51 +01:00
|
|
|
endpointsSet := d.Get("endpoints").(*schema.Set)
|
|
|
|
|
|
|
|
for _, endpointsSetI := range endpointsSet.List() {
|
|
|
|
endpoints := endpointsSetI.(map[string]interface{})
|
|
|
|
config.IamEndpoint = endpoints["iam"].(string)
|
|
|
|
config.Ec2Endpoint = endpoints["ec2"].(string)
|
|
|
|
config.ElbEndpoint = endpoints["elb"].(string)
|
2016-08-12 18:52:12 +02:00
|
|
|
config.S3Endpoint = endpoints["s3"].(string)
|
2014-11-21 17:58:34 +01:00
|
|
|
}
|
|
|
|
|
2015-04-20 00:54:42 +02:00
|
|
|
if v, ok := d.GetOk("allowed_account_ids"); ok {
|
|
|
|
config.AllowedAccountIds = v.(*schema.Set).List()
|
|
|
|
}
|
|
|
|
|
|
|
|
if v, ok := d.GetOk("forbidden_account_ids"); ok {
|
|
|
|
config.ForbiddenAccountIds = v.(*schema.Set).List()
|
|
|
|
}
|
|
|
|
|
2014-11-21 17:58:34 +01:00
|
|
|
return config.Client()
|
|
|
|
}
|
2015-08-24 15:59:54 +02:00
|
|
|
|
|
|
|
// This is a global MutexKV for use within this plugin.
|
|
|
|
var awsMutexKV = mutexkv.NewMutexKV()
|
2016-02-07 22:40:51 +01:00
|
|
|
|
2016-09-02 19:36:01 +02:00
|
|
|
func assumeRoleSchema() *schema.Schema {
|
|
|
|
return &schema.Schema{
|
|
|
|
Type: schema.TypeSet,
|
|
|
|
Optional: true,
|
|
|
|
MaxItems: 1,
|
|
|
|
Elem: &schema.Resource{
|
|
|
|
Schema: map[string]*schema.Schema{
|
|
|
|
"role_arn": {
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Description: descriptions["assume_role_role_arn"],
|
|
|
|
},
|
|
|
|
|
|
|
|
"session_name": {
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Description: descriptions["assume_role_session_name"],
|
|
|
|
},
|
|
|
|
|
|
|
|
"external_id": {
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Description: descriptions["assume_role_external_id"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Set: assumeRoleToHash,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func assumeRoleToHash(v interface{}) int {
|
|
|
|
var buf bytes.Buffer
|
|
|
|
m := v.(map[string]interface{})
|
|
|
|
buf.WriteString(fmt.Sprintf("%s-", m["role_arn"].(string)))
|
|
|
|
buf.WriteString(fmt.Sprintf("%s-", m["session_name"].(string)))
|
|
|
|
buf.WriteString(fmt.Sprintf("%s-", m["external_id"].(string)))
|
|
|
|
return hashcode.String(buf.String())
|
|
|
|
}
|
|
|
|
|
2016-02-07 22:40:51 +01:00
|
|
|
func endpointsSchema() *schema.Schema {
|
|
|
|
return &schema.Schema{
|
|
|
|
Type: schema.TypeSet,
|
|
|
|
Optional: true,
|
|
|
|
Elem: &schema.Resource{
|
|
|
|
Schema: map[string]*schema.Schema{
|
2016-09-02 19:29:59 +02:00
|
|
|
"iam": {
|
2016-02-07 22:40:51 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
|
|
|
Description: descriptions["iam_endpoint"],
|
|
|
|
},
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"ec2": {
|
2016-02-07 22:40:51 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
|
|
|
Description: descriptions["ec2_endpoint"],
|
|
|
|
},
|
|
|
|
|
2016-09-02 19:29:59 +02:00
|
|
|
"elb": {
|
2016-02-07 22:40:51 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
|
|
|
Description: descriptions["elb_endpoint"],
|
|
|
|
},
|
2016-09-02 19:29:59 +02:00
|
|
|
"s3": {
|
2016-08-12 18:52:12 +02:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Default: "",
|
|
|
|
Description: descriptions["s3_endpoint"],
|
|
|
|
},
|
2016-02-07 22:40:51 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Set: endpointsToHash,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func endpointsToHash(v interface{}) int {
|
|
|
|
var buf bytes.Buffer
|
|
|
|
m := v.(map[string]interface{})
|
|
|
|
buf.WriteString(fmt.Sprintf("%s-", m["iam"].(string)))
|
|
|
|
buf.WriteString(fmt.Sprintf("%s-", m["ec2"].(string)))
|
|
|
|
buf.WriteString(fmt.Sprintf("%s-", m["elb"].(string)))
|
2016-08-12 18:52:12 +02:00
|
|
|
buf.WriteString(fmt.Sprintf("%s-", m["s3"].(string)))
|
2016-02-07 22:40:51 +01:00
|
|
|
|
|
|
|
return hashcode.String(buf.String())
|
|
|
|
}
|