Skip to content

robbyoconnor/terraform-cloudflare-fastmail-mx

Repository files navigation

Terraform Module to set-up the MX Records for fastmail

This was developed primarily for myself, but I am releasing it in the hopes it helps someone else. This works only with Cloudflare DNS.

This will create the DNS records necessary to set up your domain name with fastmail. This configures SPF, DKIM, and DMARC properly as well.

This can be found on the Terraform Registry.

Example usage

terraform {
  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "~> 3.0"
    }
  }
}

provider "cloudflare" {
  api_token = var.cf_api_token
}

module "fastmail" {
  source          = "robbyoconnor/fastmail-mx/cloudflare"
  version         = "1.0.0"
  cf_zone_id      = var.cf_zone_id
  cf_api_token    = var.cf_api_token
  domain_name = "example.com"
}

Requirements

Name Version
cloudflare ~> 3.0

Providers

Name Version
cloudflare ~> 3.0

Modules

No modules.

Resources

Name Type
cloudflare_record.dkim resource
cloudflare_record.dmarc resource
cloudflare_record.mx resource
cloudflare_record.spf resource

Inputs

Name Description Type Default Required
cf_api_token This is the API token. You can obtain it at https://dash.cloudflare.com/profile/api-tokens string n/a yes
cf_zone_id The ID of the cloudflare zone string n/a yes
dmarc DMARC specification (optional) string "" no
domain_name The apex domain name (e.g., example.com) string n/a yes
sub_domain The sub-domain for the MX records, if applicable (optional) string "@" no
ttl TTL for the DNS records (optional) number 300 no

Outputs

No outputs.