From fc13e31a69d6d1ed62aaad3e728618d0c3045924 Mon Sep 17 00:00:00 2001
From: Kristian Klausen <kristian@klausen.dk>
Date: Sun, 27 Dec 2020 22:16:32 +0100
Subject: [PATCH] tf-stage1/archlinux: Switch archlinux_org_gitlab_pages to a
 map

---
 .gitlab/issue_templates/New GitLab Pages Project.md |  5 +----
 tf-stage1/templates.tf                              | 10 +++++-----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/.gitlab/issue_templates/New GitLab Pages Project.md b/.gitlab/issue_templates/New GitLab Pages Project.md
index a05329a12..18aeaaa80 100644
--- a/.gitlab/issue_templates/New GitLab Pages Project.md	
+++ b/.gitlab/issue_templates/New GitLab Pages Project.md	
@@ -24,10 +24,7 @@ something hosted below one of our domains is official).
 1. [ ] At this point, we'll need to add some stuff to the `archlinux_org_gitlab_pages` variable in `archlinux.tf`. It should look something like this.
        Make sure to substitute the `your-domain` and `your-code-shown-by-gitlab` strings accordingly:
 
-        {
-          name              = "your-domain"
-          verification_code = "your-code-shown-by-gitlab"
-        }
+        "your-domain" = "your-code-shown-by-gitlab"
 
 1. [ ] Run `terraform apply` and go back to GitLab. Hit `Verify` and it should pick up the new domain
        verification code. It should then also automatically begin fetching a certificate via Let's
diff --git a/tf-stage1/templates.tf b/tf-stage1/templates.tf
index ea7e3c9c0..b4974678f 100644
--- a/tf-stage1/templates.tf
+++ b/tf-stage1/templates.tf
@@ -1,20 +1,20 @@
 # This files contains template handling for the main archlinux.tf file
 
 resource "hetznerdns_record" "archlinux_org_gitlab_pages_cname" {
-  for_each = { for p in local.archlinux_org_gitlab_pages : p.name => p }
+  for_each = local.archlinux_org_gitlab_pages
 
   zone_id = hetznerdns_zone.archlinux.id
-  name    = each.value.name
+  name    = each.key
   value   = "pages.archlinux.org."
   type    = "CNAME"
 }
 
 resource "hetznerdns_record" "archlinux_org_gitlab_pages_verification_code_txt" {
-  for_each = { for p in local.archlinux_org_gitlab_pages : p.name => p }
+  for_each = local.archlinux_org_gitlab_pages
 
   zone_id = hetznerdns_zone.archlinux.id
-  name    = "_gitlab-pages-verification-code.${each.value.name}"
-  value   = "gitlab-pages-verification-code=${each.value.verification_code}"
+  name    = "_gitlab-pages-verification-code.${each.value}"
+  value   = "gitlab-pages-verification-code=${each.value}"
   type    = "TXT"
 }
 
-- 
GitLab