Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform/cloudflare: v5 provider update #1657

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions terraform/cloudflare.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ data "cloudflare_account_roles" "account_roles" {
}

resource "cloudflare_account_member" "member" {
for_each = local.cf_admins
account_id = local.cf_account_id
email_address = each.value
role_ids = [
for_each = local.cf_admins
account_id = local.cf_account_id
email = each.value
roles = [
local.cf_roles_by_name["Administrator"].id
]
}
33 changes: 22 additions & 11 deletions terraform/cloudflare_nix-community_org.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
locals {
nix_community_zone_id = "8965c5ff4e19a3ca46b5df6965f2bc36"
ttl_auto = 1

# For each github page, create a CNAME alias to nix-community.github.io
nix_community_github_pages = [
Expand Down Expand Up @@ -57,89 +58,99 @@ locals {
}
}

resource "cloudflare_record" "nix-community-org-host-A" {
resource "cloudflare_dns_record" "nix-community-org-host-A" {
for_each = local.host

ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = each.key
type = "A"
content = each.value.ipv4
}

resource "cloudflare_record" "nix-community-org-host-AAAA" {
resource "cloudflare_dns_record" "nix-community-org-host-AAAA" {
for_each = local.host

ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = each.key
type = "AAAA"
content = each.value.ipv6
}

resource "cloudflare_record" "nix-community-org-CNAME" {
resource "cloudflare_dns_record" "nix-community-org-CNAME" {
for_each = local.cname

ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = each.key
content = each.value
type = "CNAME"
}

# blocks other CAs from issuing certificates for the domain
resource "cloudflare_record" "nix-community-org-caa" {
resource "cloudflare_dns_record" "nix-community-org-caa" {
ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = "@"
type = "CAA"
data {
data = {
flags = "0"
tag = "issue"
value = "letsencrypt.org"
}
}

resource "cloudflare_record" "nix-community-org-apex-A" {
resource "cloudflare_dns_record" "nix-community-org-apex-A" {
ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = "@"
content = "nix-community.github.io"
type = "CNAME"
proxied = false
}

resource "cloudflare_record" "nix-community-org-apex-TXT" {
resource "cloudflare_dns_record" "nix-community-org-apex-TXT" {
ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = "@"
content = "v=spf1 include:_mailcust.gandi.net -all"
type = "TXT"
}

resource "cloudflare_record" "nix-community-org-apex-MX" {
resource "cloudflare_dns_record" "nix-community-org-apex-MX" {
for_each = {
"spool.mail.gandi.net." = 10
"fb.mail.gandi.net." = 50
}
ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = "@"
content = each.key
type = "MX"
priority = each.value
}

resource "cloudflare_record" "nix-community-org-github-challenge-TXT" {
resource "cloudflare_dns_record" "nix-community-org-github-challenge-TXT" {
ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = "_github-challenge-nix-community-org"
content = "2eee7c1945"
type = "TXT"
}

resource "cloudflare_record" "nix-community-org-github-pages-challenge-TXT" {
resource "cloudflare_dns_record" "nix-community-org-github-pages-challenge-TXT" {
ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = "_github-pages-challenge-nix-community.nix-community.org."
content = "6d236784300b9b1e80fdc496b7bfce"
type = "TXT"
}

resource "cloudflare_record" "nix-community-org-github-pages" {
resource "cloudflare_dns_record" "nix-community-org-github-pages" {
for_each = { for page in local.nix_community_github_pages : page => page }

ttl = local.ttl_auto
zone_id = local.nix_community_zone_id
name = each.value
content = "nix-community.github.io"
Expand Down
Loading