forked from cloudamqp/terraform-provider-cloudamqp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovider.go
35 lines (32 loc) · 1 KB
/
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
31
32
33
34
35
package main
import (
"github.com/84codes/go-api/api"
"github.com/hashicorp/terraform/helper/schema"
)
func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"apikey": &schema.Schema{
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("CLOUDAMQP_APIKEY", nil),
Description: "Key used to authentication to the CloudAMQP Customer API",
},
"baseurl": &schema.Schema{
Type: schema.TypeString,
Default: "https://customer.cloudamqp.com",
Optional: true,
Description: "Base URL to CloudAMQP Customer website",
},
},
ResourcesMap: map[string]*schema.Resource{
"cloudamqp_instance" : resourceInstance(),
"cloudamqp_notification" : resourceNotification(),
"cloudamqp_alarm" : resourceAlarm(),
},
ConfigureFunc: providerConfigure,
}
}
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
return api.New(d.Get("baseurl").(string), d.Get("apikey").(string)), nil
}