github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/builtin/providers/digitalocean/provider.go (about) 1 package digitalocean 2 3 import ( 4 "github.com/hashicorp/terraform/helper/schema" 5 "github.com/hashicorp/terraform/terraform" 6 ) 7 8 // Provider returns a schema.Provider for DigitalOcean. 9 func Provider() terraform.ResourceProvider { 10 return &schema.Provider{ 11 Schema: map[string]*schema.Schema{ 12 "token": &schema.Schema{ 13 Type: schema.TypeString, 14 Required: true, 15 DefaultFunc: schema.EnvDefaultFunc("DIGITALOCEAN_TOKEN", nil), 16 Description: "The token key for API operations.", 17 }, 18 }, 19 20 ResourcesMap: map[string]*schema.Resource{ 21 "digitalocean_domain": resourceDigitalOceanDomain(), 22 "digitalocean_droplet": resourceDigitalOceanDroplet(), 23 "digitalocean_floating_ip": resourceDigitalOceanFloatingIp(), 24 "digitalocean_record": resourceDigitalOceanRecord(), 25 "digitalocean_ssh_key": resourceDigitalOceanSSHKey(), 26 }, 27 28 ConfigureFunc: providerConfigure, 29 } 30 } 31 32 func providerConfigure(d *schema.ResourceData) (interface{}, error) { 33 config := Config{ 34 Token: d.Get("token").(string), 35 } 36 37 return config.Client() 38 }