2014-09-09 22:13:11 +02:00
|
|
|
package digitalocean
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
2014-11-17 18:55:45 +01:00
|
|
|
"github.com/hashicorp/terraform/terraform"
|
2014-09-09 22:13:11 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// Provider returns a schema.Provider for DigitalOcean.
|
2014-11-17 18:55:45 +01:00
|
|
|
func Provider() terraform.ResourceProvider {
|
2014-09-09 22:13:11 +02:00
|
|
|
return &schema.Provider{
|
|
|
|
Schema: map[string]*schema.Schema{
|
|
|
|
"token": &schema.Schema{
|
2014-11-17 18:55:45 +01:00
|
|
|
Type: schema.TypeString,
|
|
|
|
Required: true,
|
2015-01-16 18:22:09 +01:00
|
|
|
DefaultFunc: schema.EnvDefaultFunc("DIGITALOCEAN_TOKEN", nil),
|
2014-11-17 18:55:45 +01:00
|
|
|
Description: "The token key for API operations.",
|
2014-09-09 22:13:11 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2014-09-09 22:29:36 +02:00
|
|
|
ResourcesMap: map[string]*schema.Resource{
|
2015-11-04 11:38:26 +01:00
|
|
|
"digitalocean_domain": resourceDigitalOceanDomain(),
|
|
|
|
"digitalocean_droplet": resourceDigitalOceanDroplet(),
|
|
|
|
"digitalocean_floating_ip": resourceDigitalOceanFloatingIp(),
|
|
|
|
"digitalocean_record": resourceDigitalOceanRecord(),
|
|
|
|
"digitalocean_ssh_key": resourceDigitalOceanSSHKey(),
|
2016-07-11 13:09:06 +02:00
|
|
|
"digitalocean_tag": resourceDigitalOceanTag(),
|
2016-07-13 16:36:37 +02:00
|
|
|
"digitalocean_volume": resourceDigitalOceanVolume(),
|
2014-09-09 22:29:36 +02:00
|
|
|
},
|
2014-11-17 18:55:45 +01:00
|
|
|
|
|
|
|
ConfigureFunc: providerConfigure,
|
2014-09-09 22:13:11 +02:00
|
|
|
}
|
|
|
|
}
|
2014-11-17 18:55:45 +01:00
|
|
|
|
|
|
|
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
|
|
|
config := Config{
|
|
|
|
Token: d.Get("token").(string),
|
|
|
|
}
|
|
|
|
|
|
|
|
return config.Client()
|
|
|
|
}
|