▾ modified Makefile +5 -1
@@ -7,7 +7,11 @@ include .env 7 7 export 8 8 endif 9 9 10 - LANGS := en fr pt ja es10 + # languages.txt is the single source of truth for the site's language set, 11 + # shared with infra/main.tf - blog/hugo.toml's [languages.*] blocks are the 12 + # one place it can't drive directly (Tofu has no TOML parser), so keep those 13 + # in sync by hand. 14 + LANGS := $( shell cat languages.txt) 11 15 12 16 # deploy-% targets aren't listed here: giving an instantiated pattern target 13 17 # (e.g. deploy-en) to .PHONY creates an explicit no-recipe rule for it, which
@@ -7,7 +7,11 @@ include .env 7 export 7 export 8 endif 8 endif 9 9 10 - LANGS := en fr pt ja es10 + # languages.txt is the single source of truth for the site's language set, 11 + # shared with infra/main.tf - blog/hugo.toml's [languages.*] blocks are the 12 + # one place it can't drive directly (Tofu has no TOML parser), so keep those 13 + # in sync by hand. 14 + LANGS := $( shell cat languages.txt) 11 15 12 # deploy-% targets aren't listed here: giving an instantiated pattern target 16 # deploy-% targets aren't listed here: giving an instantiated pattern target 13 # (e.g. deploy-en) to .PHONY creates an explicit no-recipe rule for it, which 17 # (e.g. deploy-en) to .PHONY creates an explicit no-recipe rule for it, which
▾ modified infra/main.tf +10 -5
@@ -2,13 +2,18 @@ 2 2 # matching blog/hugo.toml's multihost [languages.*] baseURLs: each language 3 3 # is a fully separate site (public/<lang>/ from the Hugo build) deployed to 4 4 # its own subdomain, with English at the zone apex. 5 + # 6 + # The language codes themselves come from ../languages.txt, the same file 7 + # the Makefile reads for its deploy fan-out, so the two never drift apart. 8 + # blog/hugo.toml's [languages.*] blocks can't read that file too (Tofu has 9 + # no TOML parser to return the favor) - keep that one in sync by hand. 5 10 locals { 11 + language_codes = split(" ", trimspace(file("${path.module}/../languages.txt"))) 6 12 languages = { 7 - en = { hostname = var.zone_name, project_name = "mykiwi-blog-en" } 8 - fr = { hostname = "fr.${var.zone_name}", project_name = "mykiwi-blog-fr" } 9 - pt = { hostname = "pt.${var.zone_name}", project_name = "mykiwi-blog-pt" } 10 - ja = { hostname = "ja.${var.zone_name}", project_name = "mykiwi-blog-ja" } 11 - es = { hostname = "es.${var.zone_name}", project_name = "mykiwi-blog-es" } 13 + for code in local.language_codes : code => { 14 + hostname = code == "en" ? var.zone_name : "${code}.${var.zone_name}" 15 + project_name = "mykiwi-blog-${code}" 16 + } 12 17 } 13 18 } 14 19
@@ -2,13 +2,18 @@ 2 # matching blog/hugo.toml's multihost [languages.*] baseURLs: each language 2 # matching blog/hugo.toml's multihost [languages.*] baseURLs: each language 3 # is a fully separate site (public/<lang>/ from the Hugo build) deployed to 3 # is a fully separate site (public/<lang>/ from the Hugo build) deployed to 4 # its own subdomain, with English at the zone apex. 4 # its own subdomain, with English at the zone apex. 5 + # 6 + # The language codes themselves come from ../languages.txt, the same file 7 + # the Makefile reads for its deploy fan-out, so the two never drift apart. 8 + # blog/hugo.toml's [languages.*] blocks can't read that file too (Tofu has 9 + # no TOML parser to return the favor) - keep that one in sync by hand. 5 locals { 10 locals { 11 + language_codes = split(" ", trimspace(file("${path.module}/../languages.txt"))) 6 languages = { 12 languages = { 7 - en = { hostname = var.zone_name, project_name = "mykiwi-blog-en" } 13 + for code in local.language_codes : code => { 8 - fr = { hostname = "fr.${var.zone_name}", project_name = "mykiwi-blog-fr" } 14 + hostname = code == "en" ? var.zone_name : "${code}.${var.zone_name}" 9 - pt = { hostname = "pt.${var.zone_name}", project_name = "mykiwi-blog-pt" } 15 + project_name = "mykiwi-blog-${code}" 10 - ja = { hostname = "ja.${var.zone_name}", project_name = "mykiwi-blog-ja" } 16 + } 11 - es = { hostname = "es.${var.zone_name}", project_name = "mykiwi-blog-es" } 12 } 17 } 13 } 18 } 14 19
▾ added languages.txt +1 -0
new file mode 100644 @@ -0,0 +1 @@ 1 + en fr pt ja es
new file mode 100644 @@ -0,0 +1 @@ 1 + en fr pt ja es