]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - statuscake/provider.go
fix
[github/fretlink/terraform-provider-statuscake.git] / statuscake / provider.go
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": {
13 Type: schema.TypeString,
14 Required: true,
15 DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_USERNAME", nil),
16 Description: "Username for StatusCake Account.",
17 },
18 "apikey": {
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
28 "statuscake_ssl": resourceStatusCakeSsl(),
29 "statuscake_test": resourceStatusCakeTest(),
30 "statuscake_contact_group": resourceStatusCakeContactGroup(),
31 },
32
33 ConfigureFunc: providerConfigure,
34 }
35 }
36
37 func providerConfigure(d *schema.ResourceData) (interface{}, error) {
38 auth := statuscake.Auth{
39 Username: d.Get("username").(string),
40 Apikey: d.Get("apikey").(string),
41 }
42 return statuscake.New(auth)
43 }