diff options
author | stack72 <public@paulstack.co.uk> | 2015-09-28 11:39:32 +0100 |
---|---|---|
committer | stack72 <public@paulstack.co.uk> | 2015-11-27 15:03:13 +0000 |
commit | 478e133852c1c49f98c0388920142dc507479487 (patch) | |
tree | 535ff9156c6b84c45cb1c603889e4c64f94f3e30 /provider.go | |
download | terraform-provider-statuscake-478e133852c1c49f98c0388920142dc507479487.tar.gz terraform-provider-statuscake-478e133852c1c49f98c0388920142dc507479487.tar.zst terraform-provider-statuscake-478e133852c1c49f98c0388920142dc507479487.zip |
Created the initial scaffolding for the statuscake provider
Diffstat (limited to 'provider.go')
-rw-r--r-- | provider.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/provider.go b/provider.go new file mode 100644 index 0000000..7402e80 --- /dev/null +++ b/provider.go | |||
@@ -0,0 +1,39 @@ | |||
1 | package statuscake | ||
2 | |||
3 | import ( | ||
4 | "github.com/DreamItGetIT/statuscake" | ||
5 | "github.com/hashicorp/terraform/helper/schema" | ||
6 | "github.com/hashicorp/terraform/terraform" | ||
7 | ) | ||
8 | |||
9 | func Provider() terraform.ResourceProvider { | ||
10 | return &schema.Provider{ | ||
11 | Schema: map[string]*schema.Schema{ | ||
12 | "username": &schema.Schema{ | ||
13 | Type: schema.TypeString, | ||
14 | Required: true, | ||
15 | DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_USERNAME", nil), | ||
16 | Description: "Username for StatusCake Account.", | ||
17 | }, | ||
18 | "apikey": &schema.Schema{ | ||
19 | Type: schema.TypeString, | ||
20 | Required: true, | ||
21 | DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_APIKEY", nil), | ||
22 | Description: "API Key for StatusCake", | ||
23 | }, | ||
24 | }, | ||
25 | |||
26 | ResourcesMap: map[string]*schema.Resource{ | ||
27 | "statuscake_test": resourceStatusCakeTest(), | ||
28 | }, | ||
29 | |||
30 | ConfigureFunc: providerConfigure, | ||
31 | } | ||
32 | } | ||
33 | |||
34 | func providerConfigure(d *schema.ResourceData) (interface{}, error) { | ||
35 | username := d.Get("username").(string) | ||
36 | apiKey := d.Get("apikey").(string) | ||
37 | |||
38 | return statuscake.New(apiKey, username), nil | ||
39 | } | ||