-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprovider.go
58 lines (50 loc) · 1.57 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
//"github.com/bluecough/go-ftd"
)
func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"api_url": &schema.Schema{
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("FTD_API_URL", nil),
},
"username": &schema.Schema{
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("FTD_USERNAME", nil),
},
"password": &schema.Schema{
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("FTD_PASSWORD", nil),
},
"ssl_no_verify": &schema.Schema{
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("FTP_SSL_NO_VERIFY", false),
},
},
ResourcesMap: map[string]*schema.Resource{
"ciscofdm_dummy": resourceServer(),
"ciscofdm_networkobject" : resourceNetworkObject(),
"ciscofdm_networkobjectgroup" : resourceNetworkObjectGroup(),
"ciscofdm_portobject" : resourcePortObject(),
"ciscofdm_portobjectgroup" : resourcePortObjectGroup(),
"ciscofdm_accessrule" : resourceAccessRule(),
"ciscofdm_deploy" : resourceDeployObject(),
},
ConfigureFunc: providerConfigure,
}
}
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config := Config{
APIURL: d.Get("api_url").(string),
Username: d.Get("username").(string),
Password: d.Get("password").(string),
SSLNoVerify: d.Get("ssl_no_verify").(string),
}
return config.NewClient()
}