diff options
| author | seth <[email protected]> | 2024-04-18 10:38:45 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-04-18 10:39:22 -0400 |
| commit | af6df8b23346606322b851629f130f1cc2acef92 (patch) | |
| tree | 8c6f4b1d653de87296dd466380ab1c36bbf05266 /ext/terranix/cloudflare/pages_domains.nix | |
| parent | 7d9a12f18e8ef8f15903d52d22f556b6fe4e4eec (diff) | |
manage cloudflare pages with terranix
Diffstat (limited to 'ext/terranix/cloudflare/pages_domains.nix')
| -rw-r--r-- | ext/terranix/cloudflare/pages_domains.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/terranix/cloudflare/pages_domains.nix b/ext/terranix/cloudflare/pages_domains.nix new file mode 100644 index 0000000..c1273bd --- /dev/null +++ b/ext/terranix/cloudflare/pages_domains.nix @@ -0,0 +1,30 @@ +{lib, ...}: let + setDomainsFor = { + account_id, + project, + domains, + }: + lib.listToAttrs ( + map (domain: { + name = "${project}_${builtins.replaceStrings ["."] ["_"] domain}"; + value = { + inherit account_id; + project_name = lib.tfRef "resource.cloudflare_pages_project.${project}.name"; + inherit domain; + }; + }) + domains + ); +in { + resource.cloudflare_pages_domain = + setDomainsFor { + account_id = lib.tfRef "var.account_id"; + project = "personal_website"; + domains = ["mydadleft.me" "getchoo.com"]; + } + // setDomainsFor { + account_id = lib.tfRef "var.account_id"; + project = "teawie_api"; + domains = ["api.mydadleft.me" "api.getchoo.com"]; + }; +} |
