]>
Commit | Line | Data |
---|---|---|
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 | ``` |