github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/librato/provider.go (about) 1 package librato 2 3 import ( 4 "github.com/hashicorp/terraform/helper/schema" 5 "github.com/hashicorp/terraform/terraform" 6 "github.com/henrikhodne/go-librato/librato" 7 ) 8 9 // Provider returns a schema.Provider for Librato. 10 func Provider() terraform.ResourceProvider { 11 return &schema.Provider{ 12 Schema: map[string]*schema.Schema{ 13 "email": &schema.Schema{ 14 Type: schema.TypeString, 15 Required: true, 16 DefaultFunc: schema.EnvDefaultFunc("LIBRATO_EMAIL", nil), 17 Description: "The email address for the Librato account.", 18 }, 19 20 "token": &schema.Schema{ 21 Type: schema.TypeString, 22 Required: true, 23 DefaultFunc: schema.EnvDefaultFunc("LIBRATO_TOKEN", nil), 24 Description: "The auth token for the Librato account.", 25 }, 26 }, 27 28 ResourcesMap: map[string]*schema.Resource{ 29 "librato_space": resourceLibratoSpace(), 30 "librato_space_chart": resourceLibratoSpaceChart(), 31 "librato_alert": resourceLibratoAlert(), 32 "librato_service": resourceLibratoService(), 33 }, 34 35 ConfigureFunc: providerConfigure, 36 } 37 } 38 39 func providerConfigure(d *schema.ResourceData) (interface{}, error) { 40 client := librato.NewClient(d.Get("email").(string), d.Get("token").(string)) 41 42 return client, nil 43 }