github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/fastly/provider.go (about) 1 package fastly 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 "api_key": &schema.Schema{ 13 Type: schema.TypeString, 14 Optional: true, 15 DefaultFunc: schema.MultiEnvDefaultFunc([]string{ 16 "FASTLY_API_KEY", 17 }, nil), 18 Description: "Fastly API Key from https://app.fastly.com/#account", 19 }, 20 }, 21 DataSourcesMap: map[string]*schema.Resource{ 22 "fastly_ip_ranges": dataSourceFastlyIPRanges(), 23 }, 24 ResourcesMap: map[string]*schema.Resource{ 25 "fastly_service_v1": resourceServiceV1(), 26 }, 27 28 ConfigureFunc: providerConfigure, 29 } 30 } 31 32 func providerConfigure(d *schema.ResourceData) (interface{}, error) { 33 config := Config{ 34 ApiKey: d.Get("api_key").(string), 35 } 36 return config.Client() 37 }