Skip to content

KamranBiglari/terraform-null-mailer

Repository files navigation

Terraform module to send emails using SMTP server by calling an external mutt command.

Dependencies

First install the mutt cli tool:

sudo apt install mutt

Usage

module "terraform-null-mailer" {
  source  = "KamranBiglari/mailer/null"
  version = "1.0.0"
  smtp_url   = "smtp://example@hotmail.com@smtp.office365.com:587/"
  password   = "password"
  from       = "example@hotmail.com"
  to         = ["example1@hotmail.com","example2@gmail.com"]
  subject    = "Hello $${user}"
  body       = <<EOT

    Your username has been created.
    Link: $${link}

EOT

  attachments = ["./file.txt"]
  vars = {
    user = "John Doe"
    link   = "https://example.com"
  }
}

Requirements

No requirements.

Providers

Name Version
local n/a
null n/a
random n/a
template n/a

Modules

No modules.

Resources

Name Type
local_file.body resource
local_file.default resource
null_resource.default resource
random_uuid.body_file resource
template_file.body data source
template_file.subject data source

Inputs

Name Description Type Default Required
attachments Attachments list [] no
body Email body template any n/a yes
enabled Flag to enable or disable the sending of emails string "true" no
fqdn FQDN string "" no
from From address for email any n/a yes
mail_command Command to execute string "mutt" no
password Password to authenticate with the SMTP server string n/a yes
smtp_url SMTP URL string "smtp://USERNAME@smtp.office365.com:587/" no
subject Email subject template any n/a yes
to Email recipients list n/a yes
vars Parameters to pass to the body template map {} no

Outputs

Name Description
body Rendered body of the email
subject Rendered subject of the email

About

Send email via SMTP with terraform

Resources

License

Stars

Watchers

Forks

Packages

No packages published