github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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": { 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_loadbalancer": resourceDigitalOceanLoadbalancer(), 25 "digitalocean_record": resourceDigitalOceanRecord(), 26 "digitalocean_ssh_key": resourceDigitalOceanSSHKey(), 27 "digitalocean_tag": resourceDigitalOceanTag(), 28 "digitalocean_volume": resourceDigitalOceanVolume(), 29 }, 30 31 ConfigureFunc: providerConfigure, 32 } 33 } 34 35 func providerConfigure(d *schema.ResourceData) (interface{}, error) { 36 config := Config{ 37 Token: d.Get("token").(string), 38 } 39 40 return config.Client() 41 }