github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/builtin/providers/bitbucket/provider.go (about)

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