github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/logentries/provider.go (about) 1 package logentries 2 3 import ( 4 "github.com/hashicorp/terraform/helper/schema" 5 "github.com/hashicorp/terraform/terraform" 6 "github.com/logentries/le_goclient" 7 ) 8 9 // Provider returns a terraform.ResourceProvider. 10 func Provider() terraform.ResourceProvider { 11 12 // The actual provider 13 return &schema.Provider{ 14 Schema: map[string]*schema.Schema{ 15 "account_key": &schema.Schema{ 16 Type: schema.TypeString, 17 Required: true, 18 DefaultFunc: schema.EnvDefaultFunc("LOGENTRIES_ACCOUNT_KEY", nil), 19 Description: descriptions["account_key"], 20 }, 21 }, 22 23 ResourcesMap: map[string]*schema.Resource{ 24 "logentries_log": resourceLogentriesLog(), 25 "logentries_logset": resourceLogentriesLogSet(), 26 }, 27 28 ConfigureFunc: providerConfigure, 29 } 30 } 31 32 var descriptions map[string]string 33 34 func init() { 35 descriptions = map[string]string{ 36 "account_key": "The Log Entries account key.", 37 } 38 } 39 40 func providerConfigure(d *schema.ResourceData) (interface{}, error) { 41 return logentries.NewClient(d.Get("account_key").(string)), nil 42 }