github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/builtin/providers/heroku/provider.go (about) 1 package heroku 2 3 import ( 4 "log" 5 6 "github.com/hashicorp/terraform/helper/schema" 7 "github.com/hashicorp/terraform/terraform" 8 ) 9 10 // Provider returns a terraform.ResourceProvider. 11 func Provider() terraform.ResourceProvider { 12 return &schema.Provider{ 13 Schema: map[string]*schema.Schema{ 14 "email": &schema.Schema{ 15 Type: schema.TypeString, 16 Optional: true, 17 DefaultFunc: schema.EnvDefaultFunc("HEROKU_EMAIL", nil), 18 }, 19 20 "api_key": &schema.Schema{ 21 Type: schema.TypeString, 22 Optional: true, 23 DefaultFunc: schema.EnvDefaultFunc("HEROKU_API_KEY", nil), 24 }, 25 }, 26 27 ResourcesMap: map[string]*schema.Resource{ 28 "heroku_app": resourceHerokuApp(), 29 "heroku_addon": resourceHerokuAddon(), 30 "heroku_domain": resourceHerokuDomain(), 31 "heroku_drain": resourceHerokuDrain(), 32 "heroku_cert": resourceHerokuCert(), 33 }, 34 35 ConfigureFunc: providerConfigure, 36 } 37 } 38 39 func providerConfigure(d *schema.ResourceData) (interface{}, error) { 40 config := Config{ 41 Email: d.Get("email").(string), 42 APIKey: d.Get("api_key").(string), 43 } 44 45 log.Println("[INFO] Initializing Heroku client") 46 return config.Client() 47 }