|
1 | | -# terraform-null-smtp-mail |
2 | | -Terraform module to send email via an SMTP server |
| 1 | +<!-- This file was automatically generated by the `build-harness`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. --> |
| 2 | + |
| 3 | + |
| 4 | +[](https://cloudposse.com) |
| 5 | + |
| 6 | +# terraform-null-smtp-mail [](https://travis-ci.org/cloudposse/terraform-null-smtp-mail) [](https://github.com/cloudposse/terraform-null-smtp-mail/releases/latest) [](https://slack.cloudposse.com) |
| 7 | + |
| 8 | + |
| 9 | +Terraform Module to send emails using an SMTP server by calling an external `email` command. |
| 10 | + |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps. |
| 15 | + |
| 16 | + |
| 17 | +It's 100% Open Source and licensed under the [APACHE2](LICENSE). |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +## Introduction |
| 28 | + |
| 29 | +This terraform module uses an external command using the [`local-exec`](https://www.terraform.io/docs/provisioners/local-exec.html) provisioner to send emails. It's ideally suited for sending transactional emails |
| 30 | +related to the `apply` phase. For example, notifying a user of their [IAM user account](https://github.com/cloudposse/terraform-aws-iam-user) getting created or the deployment of a new [ECS application](https://github.com/cloudposse/terraform-aws-ecs-web-app). |
| 31 | + |
| 32 | +**NOTE:** The `null` refers to the primary Terraform [provider](https://www.terraform.io/docs/providers/null/index.html) used in this module. |
| 33 | + |
| 34 | +## Dependencies |
| 35 | + |
| 36 | + First install the latest release of the `email` cli tool here: https://github.com/wrouesnel/emailcli/releases |
| 37 | + |
| 38 | + Make sure it exists in your `PATH` (E.g. `/usr/local/bin`) |
| 39 | + |
| 40 | + We distribute an Alpine Linux package (`emailcli`) as part of our [toolchain](https://github.com/cloudposse/packages). |
| 41 | + |
| 42 | + ``` |
| 43 | + curl -sSL https://apk.cloudposse.com/install.sh | sudo bash |
| 44 | + apk add emailcli@cloudposse |
| 45 | + ``` |
| 46 | + |
| 47 | +## Usage |
| 48 | + |
| 49 | + |
| 50 | +```hcl |
| 51 | +module "welcome" { |
| 52 | + source = "git::https://github.com/cloudposse/terraform-null-smtp-mail.git?ref=master" |
| 53 | + host = "smtp.mailgun.org" |
| 54 | + port = "587" |
| 55 | + username = "postmaster@ourdomain.com" |
| 56 | + password = "changeme" |
| 57 | + from = "admin@yourdomain.com" |
| 58 | + to = ["example@yourdomain.com"] |
| 59 | + subject = "Welcome $${first_name}" |
| 60 | + body = "Your account has been created. Login here: $${homepage}" |
| 61 | +
|
| 62 | + vars = { |
| 63 | + first_name = "Example" |
| 64 | + homepage = "https://cloudposse.com" |
| 65 | + } |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +__NOTE:__ Use the `file(...)` interpolation function to use a template file. |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +## Makefile Targets |
| 77 | +``` |
| 78 | +Available targets: |
| 79 | +
|
| 80 | + help Help screen |
| 81 | + help/all Display help for all targets |
| 82 | + help/short This help short screen |
| 83 | + lint Lint terraform code |
| 84 | +
|
| 85 | +``` |
| 86 | + |
| 87 | +## Inputs |
| 88 | + |
| 89 | +| Name | Description | Type | Default | Required | |
| 90 | +|------|-------------|:----:|:-----:|:-----:| |
| 91 | +| body | Email body template | string | - | yes | |
| 92 | +| enabled | Flag to enable or disable the sending of emails | string | `true` | no | |
| 93 | +| from | From address for email | string | - | yes | |
| 94 | +| host | SMTP Host | string | `smtp.mailgun.org` | no | |
| 95 | +| mail_command | Command to execute | string | `email` | no | |
| 96 | +| password | Password to authenticate with the SMTP server | string | - | yes | |
| 97 | +| port | SMTP Port | string | `587` | no | |
| 98 | +| subject | Email subject template | string | - | yes | |
| 99 | +| to | Email recipients | list | - | yes | |
| 100 | +| username | Username to authenticate with the SMTP server | string | - | yes | |
| 101 | +| vars | Parameters to pass to the body template | string | `<map>` | no | |
| 102 | + |
| 103 | +## Outputs |
| 104 | + |
| 105 | +| Name | Description | |
| 106 | +|------|-------------| |
| 107 | +| body | Rendered body of the email | |
| 108 | +| subject | Rendered subject of the email | |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | +## Related Projects |
| 114 | + |
| 115 | +Check out these related projects. |
| 116 | + |
| 117 | +- [emailcli](https://github.com/wrouesnel/emailcli) - 12-factor compatible command line tool for sending emails that is written in Go. |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | +## Help |
| 122 | + |
| 123 | +**Got a question?** |
| 124 | + |
| 125 | +File a GitHub [issue](https://github.com/cloudposse/terraform-null-smtp-mail/issues), send us an [email][email] or join our [Slack Community][slack]. |
| 126 | + |
| 127 | +## Commercial Support |
| 128 | + |
| 129 | +Work directly with our team of DevOps experts via email, slack, and video conferencing. |
| 130 | + |
| 131 | +We provide [*commercial support*][commercial_support] for all of our [Open Source][github] projects. As a *Dedicated Support* customer, you have access to our team of subject matter experts at a fraction of the cost of a full-time engineer. |
| 132 | + |
| 133 | +[](mailto:hello@cloudposse.com) |
| 134 | + |
| 135 | +- **Questions.** We'll use a Shared Slack channel between your team and ours. |
| 136 | +- **Troubleshooting.** We'll help you triage why things aren't working. |
| 137 | +- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback. |
| 138 | +- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects. |
| 139 | +- **Build New Terraform Modules.** We'll develop original modules to provision infrastructure. |
| 140 | +- **Cloud Architecture.** We'll assist with your cloud strategy and design. |
| 141 | +- **Implementation.** We'll provide hands-on support to implement our reference architectures. |
| 142 | + |
| 143 | + |
| 144 | +## Community Forum |
| 145 | + |
| 146 | +Get access to our [Open Source Community Forum][slack] on Slack. It's **FREE** to join for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build *sweet* infrastructure. |
| 147 | + |
| 148 | +## Contributing |
| 149 | + |
| 150 | +### Bug Reports & Feature Requests |
| 151 | + |
| 152 | +Please use the [issue tracker](https://github.com/cloudposse/terraform-null-smtp-mail/issues) to report any bugs or file feature requests. |
| 153 | + |
| 154 | +### Developing |
| 155 | + |
| 156 | +If you are interested in being a contributor and want to get involved in developing this project or [help out](https://github.com/orgs/cloudposse/projects/3) with our other projects, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com). |
| 157 | + |
| 158 | +In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. |
| 159 | + |
| 160 | + 1. **Fork** the repo on GitHub |
| 161 | + 2. **Clone** the project to your own machine |
| 162 | + 3. **Commit** changes to your own branch |
| 163 | + 4. **Push** your work back up to your fork |
| 164 | + 5. Submit a **Pull Request** so that we can review your changes |
| 165 | + |
| 166 | +**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request! |
| 167 | + |
| 168 | + |
| 169 | +## Copyright |
| 170 | + |
| 171 | +Copyright © 2017-2018 [Cloud Posse, LLC](https://cloudposse.com) |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | +## License |
| 176 | + |
| 177 | +[](https://opensource.org/licenses/Apache-2.0) |
| 178 | + |
| 179 | +See [LICENSE](LICENSE) for full details. |
| 180 | + |
| 181 | + Licensed to the Apache Software Foundation (ASF) under one |
| 182 | + or more contributor license agreements. See the NOTICE file |
| 183 | + distributed with this work for additional information |
| 184 | + regarding copyright ownership. The ASF licenses this file |
| 185 | + to you under the Apache License, Version 2.0 (the |
| 186 | + "License"); you may not use this file except in compliance |
| 187 | + with the License. You may obtain a copy of the License at |
| 188 | + |
| 189 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 190 | + |
| 191 | + Unless required by applicable law or agreed to in writing, |
| 192 | + software distributed under the License is distributed on an |
| 193 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 194 | + KIND, either express or implied. See the License for the |
| 195 | + specific language governing permissions and limitations |
| 196 | + under the License. |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | +## Trademarks |
| 207 | + |
| 208 | +All other trademarks referenced herein are the property of their respective owners. |
| 209 | + |
| 210 | +## About |
| 211 | + |
| 212 | +This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at <hello@cloudposse.com> |
| 213 | + |
| 214 | +[](https://cloudposse.com) |
| 215 | + |
| 216 | +We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We love [Open Source Software](https://github.com/cloudposse/)! |
| 217 | + |
| 218 | +We offer paid support on all of our projects. |
| 219 | + |
| 220 | +Check out [our other projects][github], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation. |
| 221 | + |
| 222 | + [docs]: https://docs.cloudposse.com/ |
| 223 | + [website]: https://cloudposse.com/ |
| 224 | + [github]: https://github.com/cloudposse/ |
| 225 | + [commercial_support]: https://github.com/orgs/cloudposse/projects |
| 226 | + [jobs]: https://cloudposse.com/jobs/ |
| 227 | + [hire]: https://cloudposse.com/contact/ |
| 228 | + [slack]: https://slack.cloudposse.com/ |
| 229 | + [linkedin]: https://www.linkedin.com/company/cloudposse |
| 230 | + [twitter]: https://twitter.com/cloudposse/ |
| 231 | + [email]: mailto:hello@cloudposse.com |
| 232 | + |
| 233 | + |
| 234 | +### Contributors |
| 235 | + |
| 236 | +| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | |
| 237 | +|---|---|---| |
| 238 | + |
| 239 | + [osterman_homepage]: https://github.com/osterman |
| 240 | + [osterman_avatar]: https://github.com/osterman.png?size=150 |
| 241 | + [goruha_homepage]: https://github.com/goruha |
| 242 | + [goruha_avatar]: https://github.com/goruha.png?size=150 |
| 243 | + [aknysh_homepage]: https://github.com/aknysh |
| 244 | + [aknysh_avatar]: https://github.com/aknysh.png?size=150 |
| 245 | + |
| 246 | + |
0 commit comments