package mailgun import ( "log" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" ) // Provider returns a terraform.ResourceProvider. func Provider() terraform.ResourceProvider { return &schema.Provider{ Schema: map[string]*schema.Schema{ "api_key": &schema.Schema{ Type: schema.TypeString, Required: true, DefaultFunc: schema.EnvDefaultFunc("MAILGUN_API_KEY", nil), }, }, ResourcesMap: map[string]*schema.Resource{ "mailgun_domain": resourceMailgunDomain(), }, ConfigureFunc: providerConfigure, } } func providerConfigure(d *schema.ResourceData) (interface{}, error) { config := Config{ APIKey: d.Get("api_key").(string), } log.Println("[INFO] Initializing Mailgun client") return config.Client() }