diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-06-28 11:23:27 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-06-28 11:23:27 +0200 |
commit | e17f219ab8ff104f73e3c0f7515a7bb437b03d56 (patch) | |
tree | de70594e9645a382a3a4cb4addec966e96bf71eb /mailgun/provider.go | |
parent | e2966ba7a0ba5e3f87787f0a276ca5f7f6b21bd7 (diff) | |
download | terraform-provider-mailgun-e17f219ab8ff104f73e3c0f7515a7bb437b03d56.tar.gz terraform-provider-mailgun-e17f219ab8ff104f73e3c0f7515a7bb437b03d56.tar.zst terraform-provider-mailgun-e17f219ab8ff104f73e3c0f7515a7bb437b03d56.zip |
add provider without ressources and makefile
Diffstat (limited to 'mailgun/provider.go')
-rw-r--r-- | mailgun/provider.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mailgun/provider.go b/mailgun/provider.go new file mode 100644 index 0000000..8771c48 --- /dev/null +++ b/mailgun/provider.go | |||
@@ -0,0 +1,34 @@ | |||
1 | package mailgun | ||
2 | |||
3 | import ( | ||
4 | "github.com/hashicorp/terraform/helper/schema" | ||
5 | "github.com/hashicorp/terraform/terraform" | ||
6 | "github.com/mailgun/mailgun-go" | ||
7 | ) | ||
8 | |||
9 | func Provider() terraform.ResourceProvider { | ||
10 | return &schema.Provider{ | ||
11 | Schema: map[string]*schema.Schema{ | ||
12 | "domain": { | ||
13 | Type: schema.TypeString, | ||
14 | Required: true, | ||
15 | DefaultFunc: schema.EnvDefaultFunc("MAILGUN_DOMAIN", nil), | ||
16 | Description: "domain for mailgun.", | ||
17 | }, | ||
18 | "apikey": { | ||
19 | Type: schema.TypeString, | ||
20 | Required: true, | ||
21 | DefaultFunc: schema.EnvDefaultFunc("MAILGUN_APIKEY", nil), | ||
22 | Description: "API Key for mailgun", | ||
23 | }, | ||
24 | }, | ||
25 | |||
26 | ResourcesMap: map[string]*schema.Resource{}, | ||
27 | |||
28 | ConfigureFunc: providerConfigure, | ||
29 | } | ||
30 | } | ||
31 | |||
32 | func providerConfigure(d *schema.ResourceData) (interface{}, error) { | ||
33 | return mailgun.NewMailgun(d.Get("domain").(string), d.Get("apikey").(string)), nil | ||
34 | } | ||