2014-08-20 00:40:48 +02:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import (
|
2014-09-10 06:44:31 +02:00
|
|
|
"os"
|
|
|
|
|
2014-08-20 00:40:48 +02:00
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Provider returns a schema.Provider for AWS.
|
|
|
|
//
|
|
|
|
// NOTE: schema.Provider became available long after the AWS provider
|
|
|
|
// was started, so resources may not be converted to this new structure
|
|
|
|
// yet. This is a WIP. To assist with the migration, make sure any resources
|
|
|
|
// you migrate are acceptance tested, then perform the migration.
|
|
|
|
func Provider() *schema.Provider {
|
|
|
|
// TODO: Move the validation to this, requires conditional schemas
|
|
|
|
// TODO: Move the configuration to this, requires validation
|
|
|
|
|
|
|
|
return &schema.Provider{
|
2014-09-10 06:44:31 +02:00
|
|
|
Schema: map[string]*schema.Schema{
|
|
|
|
"region": &schema.Schema{
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Required: true,
|
|
|
|
DefaultFunc: func() (interface{}, error) {
|
|
|
|
return os.Getenv("AWS_REGION"), nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
"access_key": &schema.Schema{
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Required: true,
|
|
|
|
DefaultFunc: func() (interface{}, error) {
|
|
|
|
return os.Getenv("AWS_ACCESS_KEY"), nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
"secret_key": &schema.Schema{
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Required: true,
|
|
|
|
DefaultFunc: func() (interface{}, error) {
|
|
|
|
return os.Getenv("AWS_SECRET_KEY"), nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2014-08-20 01:56:23 +02:00
|
|
|
ResourcesMap: map[string]*schema.Resource{
|
2014-08-20 19:40:18 +02:00
|
|
|
"aws_eip": resourceAwsEip(),
|
2014-08-22 03:38:43 +02:00
|
|
|
"aws_instance": resourceAwsInstance(),
|
2014-08-20 19:40:18 +02:00
|
|
|
"aws_security_group": resourceAwsSecurityGroup(),
|
2014-08-20 01:56:23 +02:00
|
|
|
},
|
2014-08-20 00:40:48 +02:00
|
|
|
}
|
|
|
|
}
|