github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/softlayer/provider.go (about) 1 package softlayer 2 3 import ( 4 "github.com/hashicorp/terraform/helper/schema" 5 "github.com/hashicorp/terraform/terraform" 6 ) 7 8 func Provider() terraform.ResourceProvider { 9 return &schema.Provider{ 10 Schema: map[string]*schema.Schema{ 11 "username": &schema.Schema{ 12 Type: schema.TypeString, 13 Required: true, 14 DefaultFunc: schema.EnvDefaultFunc("SOFTLAYER_USERNAME", nil), 15 Description: "The user name for SoftLayer API operations.", 16 }, 17 "api_key": &schema.Schema{ 18 Type: schema.TypeString, 19 Required: true, 20 DefaultFunc: schema.EnvDefaultFunc("SOFTLAYER_API_KEY", nil), 21 Description: "The API key for SoftLayer API operations.", 22 }, 23 }, 24 25 ResourcesMap: map[string]*schema.Resource{ 26 "softlayer_virtual_guest": resourceSoftLayerVirtualGuest(), 27 "softlayer_ssh_key": resourceSoftLayerSSHKey(), 28 }, 29 30 ConfigureFunc: providerConfigure, 31 } 32 } 33 34 func providerConfigure(d *schema.ResourceData) (interface{}, error) { 35 config := Config{ 36 Username: d.Get("username").(string), 37 ApiKey: d.Get("api_key").(string), 38 } 39 40 return config.Client() 41 }