github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/cloudflare/provider.go (about) 1 package cloudflare 2 3 import ( 4 "github.com/hashicorp/terraform/helper/schema" 5 "github.com/hashicorp/terraform/terraform" 6 ) 7 8 // Provider returns a terraform.ResourceProvider. 9 func Provider() terraform.ResourceProvider { 10 return &schema.Provider{ 11 Schema: map[string]*schema.Schema{ 12 "email": &schema.Schema{ 13 Type: schema.TypeString, 14 Required: true, 15 DefaultFunc: schema.EnvDefaultFunc("CLOUDFLARE_EMAIL", nil), 16 Description: "A registered CloudFlare email address.", 17 }, 18 19 "token": &schema.Schema{ 20 Type: schema.TypeString, 21 Required: true, 22 DefaultFunc: schema.EnvDefaultFunc("CLOUDFLARE_TOKEN", nil), 23 Description: "The token key for API operations.", 24 }, 25 }, 26 27 ResourcesMap: map[string]*schema.Resource{ 28 "cloudflare_record": resourceCloudFlareRecord(), 29 }, 30 31 ConfigureFunc: providerConfigure, 32 } 33 } 34 35 func providerConfigure(d *schema.ResourceData) (interface{}, error) { 36 config := Config{ 37 Email: d.Get("email").(string), 38 Token: d.Get("token").(string), 39 } 40 41 return config.Client() 42 }