github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/bitbucket/provider.go (about) 1 package bitbucket 2 3 import ( 4 "net/http" 5 6 "github.com/hashicorp/terraform/helper/schema" 7 "github.com/hashicorp/terraform/terraform" 8 ) 9 10 func Provider() terraform.ResourceProvider { 11 return &schema.Provider{ 12 Schema: map[string]*schema.Schema{ 13 "username": { 14 Required: true, 15 Type: schema.TypeString, 16 DefaultFunc: schema.EnvDefaultFunc("BITBUCKET_USERNAME", nil), 17 }, 18 "password": { 19 Type: schema.TypeString, 20 Required: true, 21 DefaultFunc: schema.EnvDefaultFunc("BITBUCKET_PASSWORD", nil), 22 }, 23 }, 24 ConfigureFunc: providerConfigure, 25 ResourcesMap: map[string]*schema.Resource{ 26 "bitbucket_hook": resourceHook(), 27 "bitbucket_default_reviewers": resourceDefaultReviewers(), 28 "bitbucket_repository": resourceRepository(), 29 }, 30 } 31 } 32 33 func providerConfigure(d *schema.ResourceData) (interface{}, error) { 34 client := &BitbucketClient{ 35 Username: d.Get("username").(string), 36 Password: d.Get("password").(string), 37 HTTPClient: &http.Client{}, 38 } 39 40 return client, nil 41 }