github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/builtin/providers/pagerduty/provider.go (about) 1 package pagerduty 2 3 import ( 4 "log" 5 6 "github.com/hashicorp/terraform/helper/schema" 7 "github.com/hashicorp/terraform/terraform" 8 ) 9 10 // Provider represents a resource provider in Terraform 11 func Provider() terraform.ResourceProvider { 12 return &schema.Provider{ 13 Schema: map[string]*schema.Schema{ 14 "token": { 15 Type: schema.TypeString, 16 Required: true, 17 DefaultFunc: schema.EnvDefaultFunc("PAGERDUTY_TOKEN", nil), 18 }, 19 }, 20 21 DataSourcesMap: map[string]*schema.Resource{ 22 "pagerduty_vendor": dataSourcePagerDutyVendor(), 23 }, 24 25 ResourcesMap: map[string]*schema.Resource{ 26 "pagerduty_user": resourcePagerDutyUser(), 27 "pagerduty_team": resourcePagerDutyTeam(), 28 "pagerduty_service": resourcePagerDutyService(), 29 "pagerduty_service_integration": resourcePagerDutyServiceIntegration(), 30 "pagerduty_schedule": resourcePagerDutySchedule(), 31 "pagerduty_escalation_policy": resourcePagerDutyEscalationPolicy(), 32 }, 33 34 ConfigureFunc: providerConfigure, 35 } 36 } 37 38 func providerConfigure(data *schema.ResourceData) (interface{}, error) { 39 config := Config{Token: data.Get("token").(string)} 40 log.Println("[INFO] Initializing PagerDuty client") 41 return config.Client() 42 }