Skip to content

Instantly share code, notes, and snippets.

@wgebis
Created July 8, 2019 13:48
Show Gist options
  • Save wgebis/2b6c67e80b94e3e834a4d080eb83efc1 to your computer and use it in GitHub Desktop.
Save wgebis/2b6c67e80b94e3e834a4d080eb83efc1 to your computer and use it in GitHub Desktop.
resource "mailgun_domain" "example_mailing_domain" {
name = "m.example.com"
spam_action = "disabled"
smtp_password = "strong_password"
}
resource "cloudflare_record" "mail-receiving-dns-entry" {
count = 2
domain = "${cloudflare_zone.my_domain_entry.zone}"
type = "${lookup(mailgun_domain.example_mailing_domain.receiving_records[count.index], "record_type")}"
name = "${mailgun_domain.example_mailing_domain.name}."
value = "${lookup(mailgun_domain.example_mailing_domain.receiving_records[count.index], "value")}"
priority = "${lookup(mailgun_domain.example_mailing_domain.receiving_records[count.index], "priority")}"
}
resource "cloudflare_record" "mail-sending-dns-entry" {
count = 3
domain = "${cloudflare_zone.my_domain_entry.zone}"
type = "${lookup(mailgun_domain.example_mailing_domain.sending_records[count.index], "record_type")}"
name = "${lookup(mailgun_domain.example_mailing_domain.sending_records[count.index], "name")}."
value = "${lookup(mailgun_domain.example_mailing_domain.sending_records[count.index], "value")}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment