-
Notifications
You must be signed in to change notification settings - Fork 3
/
provider.go
30 lines (27 loc) · 971 Bytes
/
provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package trackerprovider
import (
"github.com/hashicorp/terraform/helper/schema"
"github.com/xchapter7x/terraform-provider-pivotaltracker/pkg/pt"
"github.com/xchapter7x/terraform-provider-pivotaltracker/pkg/trackerprovider/resources/projects"
)
type ProviderClient func(string) pt.ClientCaller
func Create(providerClient ProviderClient) *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"access_token": &schema.Schema{
Type: schema.TypeString,
Required: true,
Sensitive: true,
DefaultFunc: schema.EnvDefaultFunc("PVTL_TRACKER_TOKEN", ""),
Description: "Pivotal Tracker API access token",
},
},
ResourcesMap: map[string]*schema.Resource{
"pivotaltracker_project": projects.NewProjectResource(),
},
DataSourcesMap: map[string]*schema.Resource{},
ConfigureFunc: func(d *schema.ResourceData) (interface{}, error) {
return providerClient(d.Get("access_token").(string)), nil
},
}
}