예제 #1
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"host": {
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{"PGHOST", "POSTGRESQL_HOST"}, nil),
				Description: "The PostgreSQL server address",
			},
			"port": {
				Type:        schema.TypeInt,
				Optional:    true,
				Default:     5432,
				Description: "The PostgreSQL server port",
			},
			"username": {
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{"PGUSER", "POSTGRESQL_USER"}, nil),
				Description: "Username for PostgreSQL server connection",
			},
			"password": {
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{"PGPASSWORD", "POSTGRESQL_PASSWORD"}, nil),
				Description: "Password for PostgreSQL server connection",
			},
			"ssl_mode": {
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("PGSSLMODE", "require"),
				Description: "Connection mode for PostgreSQL server",
			},
			"connect_timeout": {
				Type:        schema.TypeInt,
				Optional:    true,
				Default:     15,
				DefaultFunc: schema.EnvDefaultFunc("PGCONNECT_TIMEOUT", nil),
				Description: "Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely.",
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"postgresql_database":  resourcePostgreSQLDatabase(),
			"postgresql_role":      resourcePostgreSQLRole(),
			"postgresql_extension": resourcePostgreSQLExtension(),
		},

		ConfigureFunc: providerConfigure,
	}
}
예제 #2
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"host": {
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{"PGHOST", "POSTGRESQL_HOST"}, nil),
				Description: "The PostgreSQL server address",
			},
			"port": {
				Type:        schema.TypeInt,
				Optional:    true,
				Default:     5432,
				Description: "The PostgreSQL server port",
			},
			"username": {
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{"PGUSER", "POSTGRESQL_USER"}, nil),
				Description: "Username for PostgreSQL server connection",
			},
			"password": {
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{"PGPASSWORD", "POSTGRESQL_PASSWORD"}, nil),
				Description: "Password for PostgreSQL server connection",
			},
			"ssl_mode": {
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("PGSSLMODE", "require"),
				Description: "Connection mode for PostgreSQL server",
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"postgresql_database": resourcePostgreSQLDatabase(),
			"postgresql_role":     resourcePostgreSQLRole(),
		},

		ConfigureFunc: providerConfigure,
	}
}
예제 #3
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"access_key": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_ACCESS_KEY", nil),
				Deprecated:  "Use `token` instead.",
				Description: "The API key for Scaleway API operations.",
			},
			"token": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"SCALEWAY_TOKEN",
					"SCALEWAY_ACCESS_KEY",
				}, nil),
				Description: "The API key for Scaleway API operations.",
			},
			"organization": &schema.Schema{
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_ORGANIZATION", nil),
				Description: "The Organization ID (a.k.a. 'access key') for Scaleway API operations.",
			},
			"region": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_REGION", "par1"),
				Description: "The Scaleway API region to use.",
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"scaleway_server":              resourceScalewayServer(),
			"scaleway_ip":                  resourceScalewayIP(),
			"scaleway_security_group":      resourceScalewaySecurityGroup(),
			"scaleway_security_group_rule": resourceScalewaySecurityGroupRule(),
			"scaleway_volume":              resourceScalewayVolume(),
			"scaleway_volume_attachment":   resourceScalewayVolumeAttachment(),
		},

		DataSourcesMap: map[string]*schema.Resource{
			"scaleway_bootscript": dataSourceScalewayBootscript(),
			"scaleway_image":      dataSourceScalewayImage(),
		},

		ConfigureFunc: providerConfigure,
	}
}
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	// TODO: Move the validation to this, requires conditional schemas
	// TODO: Move the configuration to this, requires validation

	// The actual provider
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"username": &schema.Schema{
				Type:        schema.TypeString,
				Required:    true,
				Description: descriptions["username"],
			},

			"password": &schema.Schema{
				Type:        schema.TypeString,
				Required:    true,
				Description: descriptions["password"],
			},

			"icfb": &schema.Schema{
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.EnvDefaultFunc("ICF_SERVER", nil),
				Description: descriptions["icfb"],
			},

			"vdc": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"ICF_VDC",
				}, nil),
				Description: descriptions["vdc"],
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"icf_instance": resourceIcfInstance(),
		},

		ConfigureFunc: providerConfigure,
	}
}
예제 #5
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"api_key": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"FASTLY_API_KEY",
				}, nil),
				Description: "Fastly API Key from https://app.fastly.com/#account",
			},
		},
		ResourcesMap: map[string]*schema.Resource{
			"fastly_service_v1": resourceServiceV1(),
		},

		ConfigureFunc: providerConfigure,
	}
}
예제 #6
0
// Provider returns a schema.Provider for OpenStack.
func Provider() terraform.ResourceProvider {
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"auth_url": &schema.Schema{
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_AUTH_URL", nil),
				Description: descriptions["auth_url"],
			},

			"user_name": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_USERNAME", ""),
				Description: descriptions["user_name"],
			},

			"user_id": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_USER_ID", ""),
				Description: descriptions["user_name"],
			},

			"tenant_id": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"OS_TENANT_ID",
					"OS_PROJECT_ID",
				}, ""),
				Description: descriptions["tenant_id"],
			},

			"tenant_name": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"OS_TENANT_NAME",
					"OS_PROJECT_NAME",
				}, ""),
				Description: descriptions["tenant_name"],
			},

			"password": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Sensitive:   true,
				DefaultFunc: schema.EnvDefaultFunc("OS_PASSWORD", ""),
				Description: descriptions["password"],
			},

			"token": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_AUTH_TOKEN", ""),
				Description: descriptions["token"],
			},

			"domain_id": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"OS_USER_DOMAIN_ID",
					"OS_PROJECT_DOMAIN_ID",
					"OS_DOMAIN_ID",
				}, ""),
				Description: descriptions["domain_id"],
			},

			"domain_name": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"OS_USER_DOMAIN_NAME",
					"OS_PROJECT_DOMAIN_NAME",
					"OS_DOMAIN_NAME",
					"OS_DEFAULT_DOMAIN",
				}, ""),
				Description: descriptions["domain_name"],
			},

			"insecure": &schema.Schema{
				Type:        schema.TypeBool,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_INSECURE", ""),
				Description: descriptions["insecure"],
			},

			"endpoint_type": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_ENDPOINT_TYPE", ""),
			},

			"cacert_file": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_CACERT", ""),
				Description: descriptions["cacert_file"],
			},

			"cert": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_CERT", ""),
				Description: descriptions["cert"],
			},

			"key": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_KEY", ""),
				Description: descriptions["key"],
			},

			"swauth": &schema.Schema{
				Type:        schema.TypeBool,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("OS_SWAUTH", ""),
				Description: descriptions["swauth"],
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"openstack_blockstorage_volume_v1":         resourceBlockStorageVolumeV1(),
			"openstack_blockstorage_volume_v2":         resourceBlockStorageVolumeV2(),
			"openstack_blockstorage_volume_attach_v2":  resourceBlockStorageVolumeAttachV2(),
			"openstack_compute_instance_v2":            resourceComputeInstanceV2(),
			"openstack_compute_keypair_v2":             resourceComputeKeypairV2(),
			"openstack_compute_secgroup_v2":            resourceComputeSecGroupV2(),
			"openstack_compute_servergroup_v2":         resourceComputeServerGroupV2(),
			"openstack_compute_floatingip_v2":          resourceComputeFloatingIPV2(),
			"openstack_compute_volume_attach_v2":       resourceComputeVolumeAttachV2(),
			"openstack_fw_firewall_v1":                 resourceFWFirewallV1(),
			"openstack_fw_policy_v1":                   resourceFWPolicyV1(),
			"openstack_fw_rule_v1":                     resourceFWRuleV1(),
			"openstack_lb_member_v1":                   resourceLBMemberV1(),
			"openstack_lb_monitor_v1":                  resourceLBMonitorV1(),
			"openstack_lb_pool_v1":                     resourceLBPoolV1(),
			"openstack_lb_vip_v1":                      resourceLBVipV1(),
			"openstack_lb_loadbalancer_v2":             resourceLoadBalancerV2(),
			"openstack_lb_listener_v2":                 resourceListenerV2(),
			"openstack_lb_pool_v2":                     resourcePoolV2(),
			"openstack_lb_member_v2":                   resourceMemberV2(),
			"openstack_lb_monitor_v2":                  resourceMonitorV2(),
			"openstack_networking_network_v2":          resourceNetworkingNetworkV2(),
			"openstack_networking_subnet_v2":           resourceNetworkingSubnetV2(),
			"openstack_networking_floatingip_v2":       resourceNetworkingFloatingIPV2(),
			"openstack_networking_port_v2":             resourceNetworkingPortV2(),
			"openstack_networking_router_v2":           resourceNetworkingRouterV2(),
			"openstack_networking_router_interface_v2": resourceNetworkingRouterInterfaceV2(),
			"openstack_networking_router_route_v2":     resourceNetworkingRouterRouteV2(),
			"openstack_networking_secgroup_v2":         resourceNetworkingSecGroupV2(),
			"openstack_networking_secgroup_rule_v2":    resourceNetworkingSecGroupRuleV2(),
			"openstack_objectstorage_container_v1":     resourceObjectStorageContainerV1(),
		},

		ConfigureFunc: configureProvider,
	}
}
예제 #7
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	// TODO: Move the validation to this, requires conditional schemas
	// TODO: Move the configuration to this, requires validation

	// The actual provider
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"access_key": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["access_key"],
			},

			"secret_key": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["secret_key"],
			},

			"token": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["token"],
			},

			"region": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_REGION",
					"AWS_DEFAULT_REGION",
				}, nil),
				Description:  descriptions["region"],
				InputDefault: "us-east-1",
			},

			"max_retries": &schema.Schema{
				Type:        schema.TypeInt,
				Optional:    true,
				Default:     11,
				Description: descriptions["max_retries"],
			},

			"allowed_account_ids": &schema.Schema{
				Type:          schema.TypeSet,
				Elem:          &schema.Schema{Type: schema.TypeString},
				Optional:      true,
				ConflictsWith: []string{"forbidden_account_ids"},
				Set: func(v interface{}) int {
					return hashcode.String(v.(string))
				},
			},

			"forbidden_account_ids": &schema.Schema{
				Type:          schema.TypeSet,
				Elem:          &schema.Schema{Type: schema.TypeString},
				Optional:      true,
				ConflictsWith: []string{"allowed_account_ids"},
				Set: func(v interface{}) int {
					return hashcode.String(v.(string))
				},
			},

			"dynamodb_endpoint": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["dynamodb_endpoint"],
			},

			"kinesis_endpoint": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["kinesis_endpoint"],
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"aws_ami":                              resourceAwsAmi(),
			"aws_ami_copy":                         resourceAwsAmiCopy(),
			"aws_ami_from_instance":                resourceAwsAmiFromInstance(),
			"aws_app_cookie_stickiness_policy":     resourceAwsAppCookieStickinessPolicy(),
			"aws_autoscaling_group":                resourceAwsAutoscalingGroup(),
			"aws_autoscaling_notification":         resourceAwsAutoscalingNotification(),
			"aws_autoscaling_policy":               resourceAwsAutoscalingPolicy(),
			"aws_autoscaling_schedule":             resourceAwsAutoscalingSchedule(),
			"aws_cloudformation_stack":             resourceAwsCloudFormationStack(),
			"aws_cloudtrail":                       resourceAwsCloudTrail(),
			"aws_cloudwatch_log_group":             resourceAwsCloudWatchLogGroup(),
			"aws_autoscaling_lifecycle_hook":       resourceAwsAutoscalingLifecycleHook(),
			"aws_cloudwatch_metric_alarm":          resourceAwsCloudWatchMetricAlarm(),
			"aws_codedeploy_app":                   resourceAwsCodeDeployApp(),
			"aws_codedeploy_deployment_group":      resourceAwsCodeDeployDeploymentGroup(),
			"aws_codecommit_repository":            resourceAwsCodeCommitRepository(),
			"aws_customer_gateway":                 resourceAwsCustomerGateway(),
			"aws_db_instance":                      resourceAwsDbInstance(),
			"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(),
			"aws_elasticache_cluster":              resourceAwsElasticacheCluster(),
			"aws_elasticache_parameter_group":      resourceAwsElasticacheParameterGroup(),
			"aws_elasticache_security_group":       resourceAwsElasticacheSecurityGroup(),
			"aws_elasticache_subnet_group":         resourceAwsElasticacheSubnetGroup(),
			"aws_elasticsearch_domain":             resourceAwsElasticSearchDomain(),
			"aws_elb":                              resourceAwsElb(),
			"aws_flow_log":                         resourceAwsFlowLog(),
			"aws_glacier_vault":                    resourceAwsGlacierVault(),
			"aws_iam_access_key":                   resourceAwsIamAccessKey(),
			"aws_iam_group_policy":                 resourceAwsIamGroupPolicy(),
			"aws_iam_group":                        resourceAwsIamGroup(),
			"aws_iam_group_membership":             resourceAwsIamGroupMembership(),
			"aws_iam_instance_profile":             resourceAwsIamInstanceProfile(),
			"aws_iam_policy":                       resourceAwsIamPolicy(),
			"aws_iam_policy_attachment":            resourceAwsIamPolicyAttachment(),
			"aws_iam_role_policy":                  resourceAwsIamRolePolicy(),
			"aws_iam_role":                         resourceAwsIamRole(),
			"aws_iam_saml_provider":                resourceAwsIamSamlProvider(),
			"aws_iam_server_certificate":           resourceAwsIAMServerCertificate(),
			"aws_iam_user_policy":                  resourceAwsIamUserPolicy(),
			"aws_iam_user":                         resourceAwsIamUser(),
			"aws_instance":                         resourceAwsInstance(),
			"aws_internet_gateway":                 resourceAwsInternetGateway(),
			"aws_key_pair":                         resourceAwsKeyPair(),
			"aws_kinesis_firehose_delivery_stream": resourceAwsKinesisFirehoseDeliveryStream(),
			"aws_kinesis_stream":                   resourceAwsKinesisStream(),
			"aws_lambda_function":                  resourceAwsLambdaFunction(),
			"aws_lambda_event_source_mapping":      resourceAwsLambdaEventSourceMapping(),
			"aws_launch_configuration":             resourceAwsLaunchConfiguration(),
			"aws_lb_cookie_stickiness_policy":      resourceAwsLBCookieStickinessPolicy(),
			"aws_main_route_table_association":     resourceAwsMainRouteTableAssociation(),
			"aws_nat_gateway":                      resourceAwsNatGateway(),
			"aws_network_acl":                      resourceAwsNetworkAcl(),
			"aws_network_acl_rule":                 resourceAwsNetworkAclRule(),
			"aws_network_interface":                resourceAwsNetworkInterface(),
			"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(),
			"aws_placement_group":                  resourceAwsPlacementGroup(),
			"aws_proxy_protocol_policy":            resourceAwsProxyProtocolPolicy(),
			"aws_rds_cluster":                      resourceAwsRDSCluster(),
			"aws_rds_cluster_instance":             resourceAwsRDSClusterInstance(),
			"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(),
			"aws_s3_bucket":                        resourceAwsS3Bucket(),
			"aws_s3_bucket_object":                 resourceAwsS3BucketObject(),
			"aws_security_group":                   resourceAwsSecurityGroup(),
			"aws_security_group_rule":              resourceAwsSecurityGroupRule(),
			"aws_spot_instance_request":            resourceAwsSpotInstanceRequest(),
			"aws_sqs_queue":                        resourceAwsSqsQueue(),
			"aws_sns_topic":                        resourceAwsSnsTopic(),
			"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(),
		},

		ConfigureFunc: providerConfigure,
	}
}
예제 #8
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	// TODO: Move the validation to this, requires conditional schemas
	// TODO: Move the configuration to this, requires validation

	// The actual provider
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"access_key": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["access_key"],
			},

			"secret_key": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["secret_key"],
			},

			"profile": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["profile"],
			},

			"shared_credentials_file": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["shared_credentials_file"],
			},

			"token": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["token"],
			},

			"region": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_REGION",
					"AWS_DEFAULT_REGION",
				}, nil),
				Description:  descriptions["region"],
				InputDefault: "us-east-1",
			},

			"max_retries": &schema.Schema{
				Type:        schema.TypeInt,
				Optional:    true,
				Default:     11,
				Description: descriptions["max_retries"],
			},

			"allowed_account_ids": &schema.Schema{
				Type:          schema.TypeSet,
				Elem:          &schema.Schema{Type: schema.TypeString},
				Optional:      true,
				ConflictsWith: []string{"forbidden_account_ids"},
				Set:           schema.HashString,
			},

			"forbidden_account_ids": &schema.Schema{
				Type:          schema.TypeSet,
				Elem:          &schema.Schema{Type: schema.TypeString},
				Optional:      true,
				ConflictsWith: []string{"allowed_account_ids"},
				Set:           schema.HashString,
			},

			"dynamodb_endpoint": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["dynamodb_endpoint"],
			},

			"kinesis_endpoint": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["kinesis_endpoint"],
			},
			"endpoints": endpointsSchema(),

			"insecure": &schema.Schema{
				Type:        schema.TypeBool,
				Optional:    true,
				Default:     false,
				Description: descriptions["insecure"],
			},
		},

		DataSourcesMap: map[string]*schema.Resource{
			"aws_ami":                      dataSourceAwsAmi(),
			"aws_availability_zones":       dataSourceAwsAvailabilityZones(),
			"aws_iam_policy_document":      dataSourceAwsIamPolicyDocument(),
			"aws_ip_ranges":                dataSourceAwsIPRanges(),
			"aws_s3_bucket_object":         dataSourceAwsS3BucketObject(),
			"aws_ecs_container_definition": dataSourceAwsEcsContainerDefinition(),
		},

		ResourcesMap: map[string]*schema.Resource{
			"aws_ami":                                      resourceAwsAmi(),
			"aws_ami_copy":                                 resourceAwsAmiCopy(),
			"aws_ami_from_instance":                        resourceAwsAmiFromInstance(),
			"aws_ami_launch_permission":                    resourceAwsAmiLaunchPermission(),
			"aws_api_gateway_account":                      resourceAwsApiGatewayAccount(),
			"aws_api_gateway_api_key":                      resourceAwsApiGatewayApiKey(),
			"aws_api_gateway_authorizer":                   resourceAwsApiGatewayAuthorizer(),
			"aws_api_gateway_deployment":                   resourceAwsApiGatewayDeployment(),
			"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(),
			"aws_appautoscaling_target":                    resourceAwsAppautoscalingTarget(),
			"aws_appautoscaling_policy":                    resourceAwsAppautoscalingPolicy(),
			"aws_autoscaling_group":                        resourceAwsAutoscalingGroup(),
			"aws_autoscaling_notification":                 resourceAwsAutoscalingNotification(),
			"aws_autoscaling_policy":                       resourceAwsAutoscalingPolicy(),
			"aws_autoscaling_schedule":                     resourceAwsAutoscalingSchedule(),
			"aws_cloudformation_stack":                     resourceAwsCloudFormationStack(),
			"aws_cloudfront_distribution":                  resourceAwsCloudFrontDistribution(),
			"aws_cloudfront_origin_access_identity":        resourceAwsCloudFrontOriginAccessIdentity(),
			"aws_cloudtrail":                               resourceAwsCloudTrail(),
			"aws_cloudwatch_event_rule":                    resourceAwsCloudWatchEventRule(),
			"aws_cloudwatch_event_target":                  resourceAwsCloudWatchEventTarget(),
			"aws_cloudwatch_log_group":                     resourceAwsCloudWatchLogGroup(),
			"aws_cloudwatch_log_metric_filter":             resourceAwsCloudWatchLogMetricFilter(),
			"aws_cloudwatch_log_subscription_filter":       resourceAwsCloudwatchLogSubscriptionFilter(),
			"aws_autoscaling_lifecycle_hook":               resourceAwsAutoscalingLifecycleHook(),
			"aws_cloudwatch_metric_alarm":                  resourceAwsCloudWatchMetricAlarm(),
			"aws_codedeploy_app":                           resourceAwsCodeDeployApp(),
			"aws_codedeploy_deployment_group":              resourceAwsCodeDeployDeploymentGroup(),
			"aws_codecommit_repository":                    resourceAwsCodeCommitRepository(),
			"aws_customer_gateway":                         resourceAwsCustomerGateway(),
			"aws_db_event_subscription":                    resourceAwsDbEventSubscription(),
			"aws_db_instance":                              resourceAwsDbInstance(),
			"aws_db_option_group":                          resourceAwsDbOptionGroup(),
			"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(),
			"aws_eip_association":                          resourceAwsEipAssociation(),
			"aws_elasticache_cluster":                      resourceAwsElasticacheCluster(),
			"aws_elasticache_parameter_group":              resourceAwsElasticacheParameterGroup(),
			"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(),
			"aws_elastictranscoder_pipeline":               resourceAwsElasticTranscoderPipeline(),
			"aws_elastictranscoder_preset":                 resourceAwsElasticTranscoderPreset(),
			"aws_elb":                                      resourceAwsElb(),
			"aws_elb_attachment":                           resourceAwsElbAttachment(),
			"aws_flow_log":                                 resourceAwsFlowLog(),
			"aws_glacier_vault":                            resourceAwsGlacierVault(),
			"aws_iam_access_key":                           resourceAwsIamAccessKey(),
			"aws_iam_account_password_policy":              resourceAwsIamAccountPasswordPolicy(),
			"aws_iam_group_policy":                         resourceAwsIamGroupPolicy(),
			"aws_iam_group":                                resourceAwsIamGroup(),
			"aws_iam_group_membership":                     resourceAwsIamGroupMembership(),
			"aws_iam_group_policy_attachment":              resourceAwsIamGroupPolicyAttachment(),
			"aws_iam_instance_profile":                     resourceAwsIamInstanceProfile(),
			"aws_iam_policy":                               resourceAwsIamPolicy(),
			"aws_iam_policy_attachment":                    resourceAwsIamPolicyAttachment(),
			"aws_iam_role_policy_attachment":               resourceAwsIamRolePolicyAttachment(),
			"aws_iam_role_policy":                          resourceAwsIamRolePolicy(),
			"aws_iam_role":                                 resourceAwsIamRole(),
			"aws_iam_saml_provider":                        resourceAwsIamSamlProvider(),
			"aws_iam_server_certificate":                   resourceAwsIAMServerCertificate(),
			"aws_iam_user_policy_attachment":               resourceAwsIamUserPolicyAttachment(),
			"aws_iam_user_policy":                          resourceAwsIamUserPolicy(),
			"aws_iam_user_ssh_key":                         resourceAwsIamUserSshKey(),
			"aws_iam_user":                                 resourceAwsIamUser(),
			"aws_instance":                                 resourceAwsInstance(),
			"aws_internet_gateway":                         resourceAwsInternetGateway(),
			"aws_key_pair":                                 resourceAwsKeyPair(),
			"aws_kinesis_firehose_delivery_stream":         resourceAwsKinesisFirehoseDeliveryStream(),
			"aws_kinesis_stream":                           resourceAwsKinesisStream(),
			"aws_kms_alias":                                resourceAwsKmsAlias(),
			"aws_kms_key":                                  resourceAwsKmsKey(),
			"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(),
			"aws_load_balancer_policy":                     resourceAwsLoadBalancerPolicy(),
			"aws_load_balancer_backend_server_policy":      resourceAwsLoadBalancerBackendServerPolicies(),
			"aws_load_balancer_listener_policy":            resourceAwsLoadBalancerListenerPolicies(),
			"aws_main_route_table_association":             resourceAwsMainRouteTableAssociation(),
			"aws_nat_gateway":                              resourceAwsNatGateway(),
			"aws_network_acl":                              resourceAwsNetworkAcl(),
			"aws_default_network_acl":                      resourceAwsDefaultNetworkAcl(),
			"aws_network_acl_rule":                         resourceAwsNetworkAclRule(),
			"aws_network_interface":                        resourceAwsNetworkInterface(),
			"aws_opsworks_application":                     resourceAwsOpsworksApplication(),
			"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(),
			"aws_opsworks_instance":                        resourceAwsOpsworksInstance(),
			"aws_opsworks_user_profile":                    resourceAwsOpsworksUserProfile(),
			"aws_opsworks_permission":                      resourceAwsOpsworksPermission(),
			"aws_placement_group":                          resourceAwsPlacementGroup(),
			"aws_proxy_protocol_policy":                    resourceAwsProxyProtocolPolicy(),
			"aws_rds_cluster":                              resourceAwsRDSCluster(),
			"aws_rds_cluster_instance":                     resourceAwsRDSClusterInstance(),
			"aws_rds_cluster_parameter_group":              resourceAwsRDSClusterParameterGroup(),
			"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(),
			"aws_ses_active_receipt_rule_set":              resourceAwsSesActiveReceiptRuleSet(),
			"aws_ses_receipt_filter":                       resourceAwsSesReceiptFilter(),
			"aws_ses_receipt_rule":                         resourceAwsSesReceiptRule(),
			"aws_ses_receipt_rule_set":                     resourceAwsSesReceiptRuleSet(),
			"aws_s3_bucket":                                resourceAwsS3Bucket(),
			"aws_s3_bucket_object":                         resourceAwsS3BucketObject(),
			"aws_s3_bucket_notification":                   resourceAwsS3BucketNotification(),
			"aws_security_group":                           resourceAwsSecurityGroup(),
			"aws_security_group_rule":                      resourceAwsSecurityGroupRule(),
			"aws_simpledb_domain":                          resourceAwsSimpleDBDomain(),
			"aws_spot_instance_request":                    resourceAwsSpotInstanceRequest(),
			"aws_spot_fleet_request":                       resourceAwsSpotFleetRequest(),
			"aws_sqs_queue":                                resourceAwsSqsQueue(),
			"aws_sns_topic":                                resourceAwsSnsTopic(),
			"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(),
			"aws_vpn_gateway_attachment":                   resourceAwsVpnGatewayAttachment(),
		},
		ConfigureFunc: providerConfigure,
	}
}
예제 #9
0
파일: provider.go 프로젝트: ryane/terraform
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"account_file": &schema.Schema{
				Type:         schema.TypeString,
				Optional:     true,
				DefaultFunc:  schema.EnvDefaultFunc("GOOGLE_ACCOUNT_FILE", nil),
				ValidateFunc: validateAccountFile,
				Deprecated:   "Use the credentials field instead",
			},

			"credentials": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"GOOGLE_CREDENTIALS",
					"GOOGLE_CLOUD_KEYFILE_JSON",
					"GCLOUD_KEYFILE_JSON",
				}, nil),
				ValidateFunc: validateCredentials,
			},

			"project": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"GOOGLE_PROJECT",
					"GCLOUD_PROJECT",
					"CLOUDSDK_CORE_PROJECT",
				}, nil),
			},

			"region": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"GOOGLE_REGION",
					"GCLOUD_REGION",
					"CLOUDSDK_COMPUTE_REGION",
				}, nil),
			},
		},

		DataSourcesMap: map[string]*schema.Resource{
			"google_iam_policy": dataSourceGoogleIamPolicy(),
		},

		ResourcesMap: map[string]*schema.Resource{
			"google_compute_autoscaler":             resourceComputeAutoscaler(),
			"google_compute_address":                resourceComputeAddress(),
			"google_compute_backend_service":        resourceComputeBackendService(),
			"google_compute_disk":                   resourceComputeDisk(),
			"google_compute_firewall":               resourceComputeFirewall(),
			"google_compute_forwarding_rule":        resourceComputeForwardingRule(),
			"google_compute_global_address":         resourceComputeGlobalAddress(),
			"google_compute_global_forwarding_rule": resourceComputeGlobalForwardingRule(),
			"google_compute_http_health_check":      resourceComputeHttpHealthCheck(),
			"google_compute_https_health_check":     resourceComputeHttpsHealthCheck(),
			"google_compute_image":                  resourceComputeImage(),
			"google_compute_instance":               resourceComputeInstance(),
			"google_compute_instance_group":         resourceComputeInstanceGroup(),
			"google_compute_instance_group_manager": resourceComputeInstanceGroupManager(),
			"google_compute_instance_template":      resourceComputeInstanceTemplate(),
			"google_compute_network":                resourceComputeNetwork(),
			"google_compute_project_metadata":       resourceComputeProjectMetadata(),
			"google_compute_route":                  resourceComputeRoute(),
			"google_compute_ssl_certificate":        resourceComputeSslCertificate(),
			"google_compute_subnetwork":             resourceComputeSubnetwork(),
			"google_compute_target_http_proxy":      resourceComputeTargetHttpProxy(),
			"google_compute_target_https_proxy":     resourceComputeTargetHttpsProxy(),
			"google_compute_target_pool":            resourceComputeTargetPool(),
			"google_compute_url_map":                resourceComputeUrlMap(),
			"google_compute_vpn_gateway":            resourceComputeVpnGateway(),
			"google_compute_vpn_tunnel":             resourceComputeVpnTunnel(),
			"google_container_cluster":              resourceContainerCluster(),
			"google_dns_managed_zone":               resourceDnsManagedZone(),
			"google_dns_record_set":                 resourceDnsRecordSet(),
			"google_sql_database":                   resourceSqlDatabase(),
			"google_sql_database_instance":          resourceSqlDatabaseInstance(),
			"google_sql_user":                       resourceSqlUser(),
			"google_project":                        resourceGoogleProject(),
			"google_pubsub_topic":                   resourcePubsubTopic(),
			"google_pubsub_subscription":            resourcePubsubSubscription(),
			"google_service_account":                resourceGoogleServiceAccount(),
			"google_storage_bucket":                 resourceStorageBucket(),
			"google_storage_bucket_acl":             resourceStorageBucketAcl(),
			"google_storage_bucket_object":          resourceStorageBucketObject(),
			"google_storage_object_acl":             resourceStorageObjectAcl(),
		},

		ConfigureFunc: providerConfigure,
	}
}
func resourceIcfInstance() *schema.Resource {
	return &schema.Resource{
		Create: resourceIcfInstanceCreate,
		Read:   resourceIcfInstanceRead,
		Update: resourceIcfInstanceUpdate,
		Delete: resourceIcfInstanceDelete,

		Schema: map[string]*schema.Schema{

			"name": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},

			"catalog": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				ForceNew: true,
			},

			"provider_access": &schema.Schema{
				Type:     schema.TypeBool,
				Optional: true,
			},

			"vdc": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"ICF_VDC",
				}, nil),
			},

			"network": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				ForceNew: true,
			},

			"public_ip": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},

			"private_ip": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},

			"enterprise_ip": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				Computed: true,
			},

			"tags": &schema.Schema{
				Type:     schema.TypeMap,
				Optional: true,
			},
		},
	}
}
예제 #11
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	// TODO: Move the validation to this, requires conditional schemas
	// TODO: Move the configuration to this, requires validation

	// These variables are closed within the `getCreds` function below.
	// This function is responsible for reading credentials from the
	// environment in the case that they're not explicitly specified
	// in the Terraform configuration.
	//
	// By using the getCreds function here instead of making the default
	// empty, we avoid asking for input on credentials if they're available
	// in the environment.
	var credVal credentials.Value
	var credErr error
	var once sync.Once
	getCreds := func() {
		// Build the list of providers to look for creds in
		providers := []credentials.Provider{
			&credentials.EnvProvider{},
			&credentials.SharedCredentialsProvider{},
		}

		// We only look in the EC2 metadata API if we can connect
		// to the metadata service within a reasonable amount of time
		conn, err := net.DialTimeout("tcp", "169.254.169.254:80", 100*time.Millisecond)
		if err == nil {
			conn.Close()
			providers = append(providers, &ec2rolecreds.EC2RoleProvider{})
		}

		credVal, credErr = credentials.NewChainCredentials(providers).Get()

		// If we didn't successfully find any credentials, just
		// set the error to nil.
		if credErr == credentials.ErrNoValidProvidersFoundInChain {
			credErr = nil
		}
	}

	// getCredDefault is a function used by DefaultFunc below to
	// get the default value for various parts of the credentials.
	// This function properly handles loading the credentials, checking
	// for errors, etc.
	getCredDefault := func(def interface{}, f func() string) (interface{}, error) {
		once.Do(getCreds)

		// If there was an error, that is always first
		if credErr != nil {
			return nil, credErr
		}

		// If the value is empty string, return nil (not set)
		val := f()
		if val == "" {
			return def, nil
		}

		return val, nil
	}

	// The actual provider
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"access_key": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: func() (interface{}, error) {
					return getCredDefault(nil, func() string {
						return credVal.AccessKeyID
					})
				},
				Description: descriptions["access_key"],
			},

			"secret_key": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: func() (interface{}, error) {
					return getCredDefault(nil, func() string {
						return credVal.SecretAccessKey
					})
				},
				Description: descriptions["secret_key"],
			},

			"token": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: func() (interface{}, error) {
					return getCredDefault("", func() string {
						return credVal.SessionToken
					})
				},
				Description: descriptions["token"],
			},

			"region": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_REGION",
					"AWS_DEFAULT_REGION",
				}, nil),
				Description:  descriptions["region"],
				InputDefault: "us-east-1",
			},

			"max_retries": &schema.Schema{
				Type:        schema.TypeInt,
				Optional:    true,
				Default:     11,
				Description: descriptions["max_retries"],
			},

			"allowed_account_ids": &schema.Schema{
				Type:          schema.TypeSet,
				Elem:          &schema.Schema{Type: schema.TypeString},
				Optional:      true,
				ConflictsWith: []string{"forbidden_account_ids"},
				Set: func(v interface{}) int {
					return hashcode.String(v.(string))
				},
			},

			"forbidden_account_ids": &schema.Schema{
				Type:          schema.TypeSet,
				Elem:          &schema.Schema{Type: schema.TypeString},
				Optional:      true,
				ConflictsWith: []string{"allowed_account_ids"},
				Set: func(v interface{}) int {
					return hashcode.String(v.(string))
				},
			},

			"dynamodb_endpoint": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["dynamodb_endpoint"],
			},

			"kinesis_endpoint": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "",
				Description: descriptions["kinesis_endpoint"],
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"aws_ami":                          resourceAwsAmi(),
			"aws_ami_copy":                     resourceAwsAmiCopy(),
			"aws_ami_from_instance":            resourceAwsAmiFromInstance(),
			"aws_app_cookie_stickiness_policy": resourceAwsAppCookieStickinessPolicy(),
			"aws_autoscaling_group":            resourceAwsAutoscalingGroup(),
			"aws_autoscaling_notification":     resourceAwsAutoscalingNotification(),
			"aws_autoscaling_policy":           resourceAwsAutoscalingPolicy(),
			"aws_cloudformation_stack":         resourceAwsCloudFormationStack(),
			"aws_cloudtrail":                   resourceAwsCloudTrail(),
			"aws_cloudwatch_log_group":         resourceAwsCloudWatchLogGroup(),
			"aws_autoscaling_lifecycle_hook":   resourceAwsAutoscalingLifecycleHook(),
			"aws_cloudwatch_metric_alarm":      resourceAwsCloudWatchMetricAlarm(),
			"aws_codedeploy_app":               resourceAwsCodeDeployApp(),
			"aws_codedeploy_deployment_group":  resourceAwsCodeDeployDeploymentGroup(),
			"aws_customer_gateway":             resourceAwsCustomerGateway(),
			"aws_db_instance":                  resourceAwsDbInstance(),
			"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_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(),
			"aws_elasticache_cluster":          resourceAwsElasticacheCluster(),
			"aws_elasticache_parameter_group":  resourceAwsElasticacheParameterGroup(),
			"aws_elasticache_security_group":   resourceAwsElasticacheSecurityGroup(),
			"aws_elasticache_subnet_group":     resourceAwsElasticacheSubnetGroup(),
			"aws_elasticsearch_domain":         resourceAwsElasticSearchDomain(),
			"aws_elb":                          resourceAwsElb(),
			"aws_flow_log":                     resourceAwsFlowLog(),
			"aws_glacier_vault":                resourceAwsGlacierVault(),
			"aws_iam_access_key":               resourceAwsIamAccessKey(),
			"aws_iam_group_policy":             resourceAwsIamGroupPolicy(),
			"aws_iam_group":                    resourceAwsIamGroup(),
			"aws_iam_group_membership":         resourceAwsIamGroupMembership(),
			"aws_iam_instance_profile":         resourceAwsIamInstanceProfile(),
			"aws_iam_policy":                   resourceAwsIamPolicy(),
			"aws_iam_policy_attachment":        resourceAwsIamPolicyAttachment(),
			"aws_iam_role_policy":              resourceAwsIamRolePolicy(),
			"aws_iam_role":                     resourceAwsIamRole(),
			"aws_iam_saml_provider":            resourceAwsIamSamlProvider(),
			"aws_iam_server_certificate":       resourceAwsIAMServerCertificate(),
			"aws_iam_user_policy":              resourceAwsIamUserPolicy(),
			"aws_iam_user":                     resourceAwsIamUser(),
			"aws_instance":                     resourceAwsInstance(),
			"aws_internet_gateway":             resourceAwsInternetGateway(),
			"aws_key_pair":                     resourceAwsKeyPair(),
			"aws_kinesis_stream":               resourceAwsKinesisStream(),
			"aws_lambda_function":              resourceAwsLambdaFunction(),
			"aws_launch_configuration":         resourceAwsLaunchConfiguration(),
			"aws_lb_cookie_stickiness_policy":  resourceAwsLBCookieStickinessPolicy(),
			"aws_main_route_table_association": resourceAwsMainRouteTableAssociation(),
			"aws_network_acl":                  resourceAwsNetworkAcl(),
			"aws_network_interface":            resourceAwsNetworkInterface(),
			"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(),
			"aws_placement_group":              resourceAwsPlacementGroup(),
			"aws_proxy_protocol_policy":        resourceAwsProxyProtocolPolicy(),
			"aws_rds_cluster":                  resourceAwsRDSCluster(),
			"aws_rds_cluster_instance":         resourceAwsRDSClusterInstance(),
			"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(),
			"aws_s3_bucket":                    resourceAwsS3Bucket(),
			"aws_s3_bucket_object":             resourceAwsS3BucketObject(),
			"aws_security_group":               resourceAwsSecurityGroup(),
			"aws_security_group_rule":          resourceAwsSecurityGroupRule(),
			"aws_spot_instance_request":        resourceAwsSpotInstanceRequest(),
			"aws_sqs_queue":                    resourceAwsSqsQueue(),
			"aws_sns_topic":                    resourceAwsSnsTopic(),
			"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(),
		},

		ConfigureFunc: providerConfigure,
	}
}
예제 #12
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"datacenter": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
			},

			"address": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"CONSUL_ADDRESS",
					"CONSUL_HTTP_ADDR",
				}, "localhost:8500"),
			},

			"scheme": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"CONSUL_SCHEME",
					"CONSUL_HTTP_SCHEME",
				}, "http"),
			},

			"ca_file": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("CONSUL_CA_FILE", ""),
			},

			"cert_file": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("CONSUL_CERT_FILE", ""),
			},

			"key_file": &schema.Schema{
				Type:        schema.TypeString,
				Optional:    true,
				DefaultFunc: schema.EnvDefaultFunc("CONSUL_KEY_FILE", ""),
			},

			"token": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"CONSUL_TOKEN",
					"CONSUL_HTTP_TOKEN",
				}, ""),
			},
		},

		DataSourcesMap: map[string]*schema.Resource{
			"consul_keys": dataSourceConsulKeys(),
		},

		ResourcesMap: map[string]*schema.Resource{
			"consul_agent_service":  resourceConsulAgentService(),
			"consul_catalog_entry":  resourceConsulCatalogEntry(),
			"consul_keys":           resourceConsulKeys(),
			"consul_key_prefix":     resourceConsulKeyPrefix(),
			"consul_node":           resourceConsulNode(),
			"consul_prepared_query": resourceConsulPreparedQuery(),
			"consul_service":        resourceConsulService(),
		},

		ConfigureFunc: providerConfigure,
	}
}
예제 #13
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	// TODO: Move the validation to this, requires conditional schemas
	// TODO: Move the configuration to this, requires validation

	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"access_key": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_ACCESS_KEY",
					"AWS_ACCESS_KEY_ID",
				}, nil),
				Description: descriptions["access_key"],
			},

			"secret_key": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_SECRET_KEY",
					"AWS_SECRET_ACCESS_KEY",
				}, nil),
				Description: descriptions["secret_key"],
			},

			"token": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_SESSION_TOKEN",
					"AWS_SECURITY_TOKEN",
				}, ""),
				Description: descriptions["token"],
			},

			"region": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_REGION",
					"AWS_DEFAULT_REGION",
				}, nil),
				Description:  descriptions["region"],
				InputDefault: "us-east-1",
			},

			"max_retries": &schema.Schema{
				Type:        schema.TypeInt,
				Optional:    true,
				Default:     11,
				Description: descriptions["max_retries"],
			},

			"allowed_account_ids": &schema.Schema{
				Type:          schema.TypeSet,
				Elem:          &schema.Schema{Type: schema.TypeString},
				Optional:      true,
				ConflictsWith: []string{"forbidden_account_ids"},
				Set: func(v interface{}) int {
					return hashcode.String(v.(string))
				},
			},

			"forbidden_account_ids": &schema.Schema{
				Type:          schema.TypeSet,
				Elem:          &schema.Schema{Type: schema.TypeString},
				Optional:      true,
				ConflictsWith: []string{"allowed_account_ids"},
				Set: func(v interface{}) int {
					return hashcode.String(v.(string))
				},
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"aws_app_cookie_stickiness_policy": resourceAwsAppCookieStickinessPolicy(),
			"aws_autoscaling_group":            resourceAwsAutoscalingGroup(),
			"aws_autoscaling_notification":     resourceAwsAutoscalingNotification(),
			"aws_autoscaling_policy":           resourceAwsAutoscalingPolicy(),
			"aws_cloudwatch_metric_alarm":      resourceAwsCloudWatchMetricAlarm(),
			"aws_customer_gateway":             resourceAwsCustomerGateway(),
			"aws_db_instance":                  resourceAwsDbInstance(),
			"aws_db_parameter_group":           resourceAwsDbParameterGroup(),
			"aws_db_security_group":            resourceAwsDbSecurityGroup(),
			"aws_db_subnet_group":              resourceAwsDbSubnetGroup(),
			"aws_dynamodb_table":               resourceAwsDynamoDbTable(),
			"aws_ebs_volume":                   resourceAwsEbsVolume(),
			"aws_ecs_cluster":                  resourceAwsEcsCluster(),
			"aws_ecs_service":                  resourceAwsEcsService(),
			"aws_ecs_task_definition":          resourceAwsEcsTaskDefinition(),
			"aws_eip":                          resourceAwsEip(),
			"aws_elasticache_cluster":          resourceAwsElasticacheCluster(),
			"aws_elasticache_security_group":   resourceAwsElasticacheSecurityGroup(),
			"aws_elasticache_subnet_group":     resourceAwsElasticacheSubnetGroup(),
			"aws_elb":                          resourceAwsElb(),
			"aws_flow_log":                     resourceAwsFlowLog(),
			"aws_iam_access_key":               resourceAwsIamAccessKey(),
			"aws_iam_group_policy":             resourceAwsIamGroupPolicy(),
			"aws_iam_group":                    resourceAwsIamGroup(),
			"aws_iam_group_membership":         resourceAwsIamGroupMembership(),
			"aws_iam_instance_profile":         resourceAwsIamInstanceProfile(),
			"aws_iam_policy":                   resourceAwsIamPolicy(),
			"aws_iam_role_policy":              resourceAwsIamRolePolicy(),
			"aws_iam_role":                     resourceAwsIamRole(),
			"aws_iam_server_certificate":       resourceAwsIAMServerCertificate(),
			"aws_iam_user_policy":              resourceAwsIamUserPolicy(),
			"aws_iam_user":                     resourceAwsIamUser(),
			"aws_instance":                     resourceAwsInstance(),
			"aws_internet_gateway":             resourceAwsInternetGateway(),
			"aws_key_pair":                     resourceAwsKeyPair(),
			"aws_kinesis_stream":               resourceAwsKinesisStream(),
			"aws_lambda_function":              resourceAwsLambdaFunction(),
			"aws_launch_configuration":         resourceAwsLaunchConfiguration(),
			"aws_lb_cookie_stickiness_policy":  resourceAwsLBCookieStickinessPolicy(),
			"aws_main_route_table_association": resourceAwsMainRouteTableAssociation(),
			"aws_network_acl":                  resourceAwsNetworkAcl(),
			"aws_network_interface":            resourceAwsNetworkInterface(),
			"aws_proxy_protocol_policy":        resourceAwsProxyProtocolPolicy(),
			"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_table":                  resourceAwsRouteTable(),
			"aws_route_table_association":      resourceAwsRouteTableAssociation(),
			"aws_s3_bucket":                    resourceAwsS3Bucket(),
			"aws_security_group":               resourceAwsSecurityGroup(),
			"aws_security_group_rule":          resourceAwsSecurityGroupRule(),
			"aws_spot_instance_request":        resourceAwsSpotInstanceRequest(),
			"aws_sqs_queue":                    resourceAwsSqsQueue(),
			"aws_sns_topic":                    resourceAwsSnsTopic(),
			"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_vpn_connection":               resourceAwsVpnConnection(),
			"aws_vpn_connection_route":         resourceAwsVpnConnectionRoute(),
			"aws_vpn_gateway":                  resourceAwsVpnGateway(),
		},

		ConfigureFunc: providerConfigure,
	}
}
예제 #14
0
// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
	// TODO: Move the validation to this, requires conditional schemas
	// TODO: Move the configuration to this, requires validation

	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"access_key": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_ACCESS_KEY",
					"AWS_ACCESS_KEY_ID",
				}, nil),
				Description: descriptions["access_key"],
			},

			"secret_key": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_SECRET_KEY",
					"AWS_SECRET_ACCESS_KEY",
				}, nil),
				Description: descriptions["secret_key"],
			},

			"region": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
				DefaultFunc: schema.MultiEnvDefaultFunc([]string{
					"AWS_REGION",
					"AWS_DEFAULT_REGION",
				}, nil),
				Description:  descriptions["region"],
				InputDefault: "us-east-1",
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"aws_autoscaling_group":            resourceAwsAutoscalingGroup(),
			"aws_db_instance":                  resourceAwsDbInstance(),
			"aws_db_parameter_group":           resourceAwsDbParameterGroup(),
			"aws_db_security_group":            resourceAwsDbSecurityGroup(),
			"aws_db_subnet_group":              resourceAwsDbSubnetGroup(),
			"aws_eip":                          resourceAwsEip(),
			"aws_elb":                          resourceAwsElb(),
			"aws_instance":                     resourceAwsInstance(),
			"aws_internet_gateway":             resourceAwsInternetGateway(),
			"aws_key_pair":                     resourceAwsKeyPair(),
			"aws_launch_configuration":         resourceAwsLaunchConfiguration(),
			"aws_main_route_table_association": resourceAwsMainRouteTableAssociation(),
			"aws_network_acl":                  resourceAwsNetworkAcl(),
			"aws_network_interface":            resourceAwsNetworkInterface(),
			"aws_route53_record":               resourceAwsRoute53Record(),
			"aws_route53_zone":                 resourceAwsRoute53Zone(),
			"aws_route_table":                  resourceAwsRouteTable(),
			"aws_route_table_association":      resourceAwsRouteTableAssociation(),
			"aws_s3_bucket":                    resourceAwsS3Bucket(),
			"aws_security_group":               resourceAwsSecurityGroup(),
			"aws_subnet":                       resourceAwsSubnet(),
			"aws_vpc":                          resourceAwsVpc(),
			"aws_vpc_peering_connection":       resourceAwsVpcPeeringConnection(),
			"aws_vpn_gateway":                  resourceAwsVpnGateway(),
		},

		ConfigureFunc: providerConfigure,
	}
}