diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-07-04 13:31:58 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-07-04 14:25:40 +0200 |
commit | a1f9b9a1c1a80ee4db8de66fe1b771fe8e28cd05 (patch) | |
tree | 2841fe577e2927dc4b0e9df04c7535c9fb8d31de | |
parent | dd1186fd91ca40f876130a596f53ebef14cf8815 (diff) | |
download | terraform-provider-mailgun-a1f9b9a1c1a80ee4db8de66fe1b771fe8e28cd05.tar.gz terraform-provider-mailgun-a1f9b9a1c1a80ee4db8de66fe1b771fe8e28cd05.tar.zst terraform-provider-mailgun-a1f9b9a1c1a80ee4db8de66fe1b771fe8e28cd05.zip |
add doc
-rw-r--r-- | GNUmakefile | 17 | ||||
-rw-r--r-- | main.go | 2 | ||||
-rwxr-xr-x | scripts/changelog-links.sh | 31 | ||||
-rwxr-xr-x | scripts/gogetcookie.sh | 10 | ||||
-rw-r--r-- | website/docs/index.html.markdown | 63 | ||||
-rw-r--r-- | website/docs/r/domain.html.markdown | 84 | ||||
-rw-r--r-- | website/docs/r/route.html.markdown | 51 | ||||
-rw-r--r-- | website/mailgun.erb | 29 |
8 files changed, 286 insertions, 1 deletions
diff --git a/GNUmakefile b/GNUmakefile index 0e2ce73..f5f0c29 100644 --- a/GNUmakefile +++ b/GNUmakefile | |||
@@ -1,6 +1,7 @@ | |||
1 | TEST?=$$(go list ./... |grep -v 'vendor') | 1 | TEST?=$$(go list ./... |grep -v 'vendor') |
2 | GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor) | 2 | GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor) |
3 | PKG_NAME=mailgun | 3 | PKG_NAME=mailgun |
4 | WEBSITE_REPO=github.com/hashicorp/terraform-website | ||
4 | 5 | ||
5 | default: build | 6 | default: build |
6 | 7 | ||
@@ -42,3 +43,19 @@ test-compile: | |||
42 | fi | 43 | fi |
43 | go test -c $(TEST) $(TESTARGS) | 44 | go test -c $(TEST) $(TESTARGS) |
44 | 45 | ||
46 | website: | ||
47 | ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO))) | ||
48 | echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..." | ||
49 | git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO) | ||
50 | endif | ||
51 | @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME) | ||
52 | |||
53 | website-test: | ||
54 | ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO))) | ||
55 | echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..." | ||
56 | git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO) | ||
57 | endif | ||
58 | @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME) | ||
59 | |||
60 | .PHONY: build test testacc vet fmt fmtcheck errcheck test-compile website website-test | ||
61 | |||
@@ -1,7 +1,7 @@ | |||
1 | package main | 1 | package main |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/alexandreFre/terraform-provider-mailgun/mailgun" | 4 | "github.com/fretlink/terraform-provider-mailgun/mailgun" |
5 | "github.com/hashicorp/terraform/plugin" | 5 | "github.com/hashicorp/terraform/plugin" |
6 | ) | 6 | ) |
7 | 7 | ||
diff --git a/scripts/changelog-links.sh b/scripts/changelog-links.sh new file mode 100755 index 0000000..303341b --- /dev/null +++ b/scripts/changelog-links.sh | |||
@@ -0,0 +1,31 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # This script rewrites [GH-nnnn]-style references in the CHANGELOG.md file to | ||
4 | # be Markdown links to the given github issues. | ||
5 | # | ||
6 | # This is run during releases so that the issue references in all of the | ||
7 | # released items are presented as clickable links, but we can just use the | ||
8 | # easy [GH-nnnn] shorthand for quickly adding items to the "Unrelease" section | ||
9 | # while merging things between releases. | ||
10 | |||
11 | set -e | ||
12 | |||
13 | if [[ ! -f CHANGELOG.md ]]; then | ||
14 | echo "ERROR: CHANGELOG.md not found in pwd." | ||
15 | echo "Please run this from the root of the terraform provider repository" | ||
16 | exit 1 | ||
17 | fi | ||
18 | |||
19 | if [[ `uname` == "Darwin" ]]; then | ||
20 | echo "Using BSD sed" | ||
21 | SED="sed -i.bak -E -e" | ||
22 | else | ||
23 | echo "Using GNU sed" | ||
24 | SED="sed -i.bak -r -e" | ||
25 | fi | ||
26 | |||
27 | PROVIDER_URL="https:\/\/github.com\/terraform-providers\/terraform-provider-statuscake\/issues" | ||
28 | |||
29 | $SED "s/GH-([0-9]+)/\[#\1\]\($PROVIDER_URL\/\1\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md | ||
30 | |||
31 | rm CHANGELOG.md.bak | ||
diff --git a/scripts/gogetcookie.sh b/scripts/gogetcookie.sh new file mode 100755 index 0000000..26c63a6 --- /dev/null +++ b/scripts/gogetcookie.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | touch ~/.gitcookies | ||
4 | chmod 0600 ~/.gitcookies | ||
5 | |||
6 | git config --global http.cookiefile ~/.gitcookies | ||
7 | |||
8 | tr , \\t <<\__END__ >>~/.gitcookies | ||
9 | .googlesource.com,TRUE,/,TRUE,2147483647,o,git-paul.hashicorp.com=1/z7s05EYPudQ9qoe6dMVfmAVwgZopEkZBb1a2mA5QtHE | ||
10 | __END__ | ||
diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown new file mode 100644 index 0000000..fbdd1ba --- /dev/null +++ b/website/docs/index.html.markdown | |||
@@ -0,0 +1,63 @@ | |||
1 | --- | ||
2 | layout: "mailgun" | ||
3 | page_title: "Provider: Mailgun" | ||
4 | sidebar_current: "docs-mailgun-index" | ||
5 | description: |- | ||
6 | The Mailgun provider configures domains and routes in Mailgun. | ||
7 | --- | ||
8 | |||
9 | # Mailgun Provider | ||
10 | |||
11 | The Mailgun provider allows Terraform to create and configure domains and routes in [Mailgun](https://www.mailgun.com/). | ||
12 | |||
13 | The provider configuration block accepts the following arguments: | ||
14 | |||
15 | * ``domain`` - (Required) The domain name for the ressources created with the provider. May alternatively be set via the | ||
16 | ``MAILGUN_DOMAIN`` environment variable. | ||
17 | |||
18 | * ``apikey`` - (Required) The API auth token to use when making requests. May alternatively | ||
19 | be set via the ``MAILGUN_APIKEY`` environment variable. | ||
20 | |||
21 | Use the navigation to the left to read about the available resources. | ||
22 | |||
23 | ## Example Usage | ||
24 | |||
25 | ```hcl | ||
26 | provider "mailgun" { | ||
27 | domain = "domain.com" | ||
28 | apikey = "15ee99178cc7q6325df7ff8a15211228-2f778ta3-e04c2946" | ||
29 | } | ||
30 | |||
31 | resource "mailgun_domain" "example" { | ||
32 | name="domain.com" | ||
33 | spam_action="block" | ||
34 | smtp_password="password" | ||
35 | wildcard=true | ||
36 | force_dkim_authority=true | ||
37 | dkim_key_size=1024 | ||
38 | ips=["192.161.0.1", "192.168.0.2"] | ||
39 | credentials{ | ||
40 | login="login" | ||
41 | password="password" | ||
42 | } | ||
43 | open_tracking_settings_active=true | ||
44 | click_tracking_settings_active=true | ||
45 | unsubscribe_tracking_settings_active=true | ||
46 | unsubscribe_tracking_settings_html_footer="<p>footer</p>" | ||
47 | unsubscribe_tracking_settings_text_footer="footer" | ||
48 | require_tls=true | ||
49 | skip_verification=true | ||
50 | } | ||
51 | |||
52 | resource "mailgun_route" "example" { | ||
53 | depends_on = [mailgun_domain.example] | ||
54 | priority=5 | ||
55 | description="description" | ||
56 | expression="match_recipient(\".*@samples.mailgun.org\")" | ||
57 | actions=[ | ||
58 | "forward(\"http://myhost.com/messages/\")", | ||
59 | "stop()" | ||
60 | ] | ||
61 | } | ||
62 | |||
63 | ``` | ||
diff --git a/website/docs/r/domain.html.markdown b/website/docs/r/domain.html.markdown new file mode 100644 index 0000000..01d300f --- /dev/null +++ b/website/docs/r/domain.html.markdown | |||
@@ -0,0 +1,84 @@ | |||
1 | --- | ||
2 | layout: "mailgun" | ||
3 | page_title: "Mailgun: mailgun_domain" | ||
4 | sidebar_current: "docs-mailgun-domain" | ||
5 | description: |- | ||
6 | The domain_resource allows mailgun domain to be managed by Terraform. | ||
7 | --- | ||
8 | |||
9 | # mailgun\_domain | ||
10 | |||
11 | The domain resource allows Mailgun domain to be managed by Terraform. | ||
12 | |||
13 | ## Example Usage | ||
14 | |||
15 | ```hcl | ||
16 | resource "mailgun_domain" "example" { | ||
17 | name="domain.com" | ||
18 | spam_action="block" | ||
19 | smtp_password="password" | ||
20 | wildcard=true | ||
21 | force_dkim_authority=true | ||
22 | dkim_key_size=1024 | ||
23 | ips=["192.161.0.1", "192.168.0.2"] | ||
24 | credentials{ | ||
25 | login="login" | ||
26 | password="password" | ||
27 | } | ||
28 | open_tracking_settings_active=true | ||
29 | click_tracking_settings_active=true | ||
30 | unsubscribe_tracking_settings_active=true | ||
31 | unsubscribe_tracking_settings_html_footer="<p>footer</p>" | ||
32 | unsubscribe_tracking_settings_text_footer="footer" | ||
33 | require_tls=true | ||
34 | skip_verification=true | ||
35 | } | ||
36 | ``` | ||
37 | |||
38 | ## Argument Reference | ||
39 | |||
40 | The following arguments are supported: | ||
41 | |||
42 | * `name` - (Required) Name of the domain | ||
43 | * `spam_action` - (Optional) "disabled", "block", or "tag".If "disabled", no spam filtering will occur for inbound messages.If "block", inbound spam messages will not be delivered.If "tag", inbound messages will be tagged with a spam header. See Spam Filter.Defaults to disabled. | ||
44 | * `smtp_password` - (Optional) Password for SMTP authentication | ||
45 | * `wildcard` - (Optional) Determines whether the domain will accept email for sub-domains when sending messages.Defaults to false. | ||
46 | * `force_dkim_authority` - (Optional) If set to true, the domain will be the DKIM authority for itself even if the root domain is registered on the same mailgun account.If set to false, the domain will have the same DKIM authority as the root domain registered on the same mailgun account. Defaults to false | ||
47 | * `dkim_key_size` - (Optional) 1024 or 2048. Set the length of your domain’s generated DKIM key. Defaults to 1024. | ||
48 | * `ips` - (Optional) An optional, comma-separated list of IP addresses to be assigned to this domain. If not specified, all dedicated IP addresses on the account will be assigned. If the request cannot be fulfilled (e.g. a requested IP is not assigned to the account, etc), a 400 will be returned. | ||
49 | * `credentials` - (Optional) SMTP credentials for the domain | ||
50 | * `open_tracking_settings_active` - (Optional) true to enable open tracking. Defauls to false | ||
51 | * `click_tracking_settings_active` - (Optional) true to enable click tracking. Defauls to false | ||
52 | * `unsubscribe_tracking_settings_active` - (Optional) true to enable unsubscribe tracking. Defauls to false | ||
53 | * `unsubscribe_tracking_settings_html_footer` - (Optional)Custom HTML version of unsubscribe footer.Defaults to "\n<br>\n<p><a hre=\"%unsubscribe_url%\">unsubscribe</a></p>\n" | ||
54 | * `unsubscribe_tracking_settings_text_footer` - (Optional) Custom text version of unsubscribe footer. Defaults to "\n\nTo unsubscribe click: <%unsubscribe_url%>\n\n" | ||
55 | * `require_tls` - (Optional) If set to true, this requires the message only be sent over a TLS connection. If a TLS connection can not be established, Mailgun will not deliver the message.If set to false, Mailgun will still try and upgrade the connection, but if Mailgun cannot, the message will be delivered over a plaintext SMTP connection. Defaults to false. | ||
56 | * `skip_verification` - (Optional)If set to true, the certificate and hostname will not be verified when trying to establish a TLS connection and Mailgun will accept any certificate during delivery. If set to false, Mailgun will verify the certificate and hostname. If either one can not be verified, a TLS connection will not be established. Defaults to false. | ||
57 | The `credentials` object supports the following: | ||
58 | * `login` - (Required) The user name | ||
59 | * `password` - (Required) A password for the SMTP credentials. (Length Min 5, Max 32) | ||
60 | |||
61 | ## Attributes Reference | ||
62 | |||
63 | The following attribute is exported: | ||
64 | |||
65 | * `smtp_login` - An username for the SMTP credentials. | ||
66 | * `created_at` - The date of creation of the domain. | ||
67 | * `state` - The state of the domain. | ||
68 | * `receiving_records` - DNS records for receiving. | ||
69 | * `sending_records` - DNS records for sending. | ||
70 | The `receiving_records` `sending_records` and object exports the following: | ||
71 | * `name` - The name of the record. | ||
72 | * `priority` - The priority of the record lower value means a more important priority. | ||
73 | * `record_type` - The type of record. | ||
74 | * `valid` - Wether the record is valid or not. | ||
75 | * `value` - The value of the record. | ||
76 | |||
77 | ## Import | ||
78 | |||
79 | Mailgun domain can be imported using the domain name, e.g. | ||
80 | |||
81 | ``` | ||
82 | tf import mailgun_domain.example domain.com | ||
83 | |||
84 | ``` | ||
diff --git a/website/docs/r/route.html.markdown b/website/docs/r/route.html.markdown new file mode 100644 index 0000000..8452f01 --- /dev/null +++ b/website/docs/r/route.html.markdown | |||
@@ -0,0 +1,51 @@ | |||
1 | --- | ||
2 | layout: "mailgun" | ||
3 | page_title: "Mailgun: mailgun_route" | ||
4 | sidebar_current: "docs-mailgun-route" | ||
5 | description: |- | ||
6 | The route_resource allows mailgun route to be managed by Terraform. | ||
7 | --- | ||
8 | |||
9 | # mailgun\_route | ||
10 | |||
11 | The route resource allows Mailgun route to be managed by Terraform. | ||
12 | |||
13 | ## Example Usage | ||
14 | |||
15 | ```hcl | ||
16 | resource "mailgun_route" "example" { | ||
17 | priority=5 | ||
18 | description="description" | ||
19 | expression="match_recipient(\".*@samples.mailgun.org\")" | ||
20 | actions=[ | ||
21 | "forward(\"http://myhost.com/messages/\")", | ||
22 | "stop()" | ||
23 | ] | ||
24 | } | ||
25 | ``` | ||
26 | |||
27 | ## Argument Reference | ||
28 | |||
29 | The following arguments are supported: | ||
30 | |||
31 | * `priority` - (Required)Integer: smaller number indicates higher priority. Higher priority routes are handled first. | ||
32 | * `expression` - (Required) An arbitrary string. | ||
33 | * `description` - (Required) A filter expression like match_recipient('.*@gmail.com') | ||
34 | * `actions` - (Required) Route action. This action is executed when the expression evaluates to True. Example: forward("alice@example.com") You can pass multiple action parameters. | ||
35 | |||
36 | |||
37 | ## Attributes Reference | ||
38 | |||
39 | The following attribute is exported: | ||
40 | |||
41 | * `route_id` - ID of the route. | ||
42 | * `created_at` - The date of creation of the route. | ||
43 | |||
44 | ## Import | ||
45 | |||
46 | Mailgun can be imported using the route ID, e.g. | ||
47 | |||
48 | ``` | ||
49 | tf import mailgun_route.example 4f3bad2335335426750048c6 | ||
50 | |||
51 | ``` | ||
diff --git a/website/mailgun.erb b/website/mailgun.erb new file mode 100644 index 0000000..4841bfe --- /dev/null +++ b/website/mailgun.erb | |||
@@ -0,0 +1,29 @@ | |||
1 | <% wrap_layout :inner do %> | ||
2 | <% content_for :sidebar do %> | ||
3 | <div class="docs-sidebar hidden-print affix-top" role="complementary"> | ||
4 | <ul class="nav docs-sidenav"> | ||
5 | <li<%= sidebar_current("docs-home") %>> | ||
6 | <a href="/docs/providers/index.html">All Providers</a> | ||
7 | </li> | ||
8 | |||
9 | <li<%= sidebar_current("docs-mailgun-index") %>> | ||
10 | <a href="/docs/providers/mailgun/index.html">Mailgun Provider</a> | ||
11 | </li> | ||
12 | |||
13 | <li<%= sidebar_current("docs-mailgun-resource") %>> | ||
14 | <a href="#">Resources</a> | ||
15 | <ul class="nav nav-visible"> | ||
16 | <li<%= sidebar_current("docs-mailgun-domain") %>> | ||
17 | <a href="/docs/providers/mailgun/r/domain.html">mailgun_domain</a> | ||
18 | </li> | ||
19 | <li<%= sidebar_current("docs-mailgun-route") %>> | ||
20 | <a href="/docs/providers/mailgun/r/route.html">mailgun_route</a> | ||
21 | </li> | ||
22 | </ul> | ||
23 | </li> | ||
24 | </ul> | ||
25 | </div> | ||
26 | <% end %> | ||
27 | |||
28 | <%= yield %> | ||
29 | <% end %> | ||