terraform/gandi: introduce proxyRecords and proxy web services

This commit is contained in:
mei (ckie) 2024-07-14 20:46:38 +03:00
parent a44196fc3c
commit 2763fb8bfb
Signed by: ckie
GPG key ID: 13E79449C0525215

View file

@ -29,6 +29,18 @@ in
inherit name ttl type values; inherit name ttl type values;
}; };
proxyRecords = name: ttl: type: values: [
# kurisu.lahfa.xyz running a sniproxy:
(record name ttl "A" ["163.172.69.160"])
(record name ttl type values)
];
# Creates a extra *.p record pointing to the sniproxy
dualProxyRecords = name: ttl: type: values: lib.flatten [
(record name ttl type values)
(proxyRecords "${name}.p" ttl type values)
];
# TODO: make less fragile and have actual unique and stable names # TODO: make less fragile and have actual unique and stable names
canonicalName = record: let canonicalName = record: let
name = builtins.replaceStrings ["." "@"] ["_" "_root_"] record.name; name = builtins.replaceStrings ["." "@"] ["_" "_root_"] record.name;
@ -41,32 +53,29 @@ in
value = record // { value = record // {
zone = tf.ref "resource.gandi_livedns_domain.forkos_org.id"; zone = tf.ref "resource.gandi_livedns_domain.forkos_org.id";
}; };
}) records); }) (lib.flatten records));
in forkosRecords ([ in forkosRecords ([
# (record "@" 3600 "A" ["163.172.69.160"]) # (record "@" 3600 "A" ["163.172.69.160"])
(record "@" 3600 "AAAA" ["2001:bc8:38ee:100:1000::20"]) (record "@" 3600 "AAAA" ["2001:bc8:38ee:100:1000::20"])
(record "cl" 3600 "A" ["163.172.69.160"]) (proxyRecords "cl" 3600 "AAAA" ["2001:bc8:38ee:100:1000::10"])
(record "cl" 3600 "AAAA" ["2001:bc8:38ee:100:1000::10"])
(record "fodwatch" 3600 "A" ["163.172.69.160"]) (proxyRecords "fodwatch" 3600 "AAAA" ["2001:bc8:38ee:100:1000::30"])
(record "fodwatch" 3600 "AAAA" ["2001:bc8:38ee:100:1000::30"])
(record "netbox" 3600 "A" ["163.172.69.160"]) (proxyRecords "netbox" 3600 "AAAA" ["2001:bc8:38ee:100:1000::20"])
(record "netbox" 3600 "AAAA" ["2001:bc8:38ee:100:1000::20"])
(record "bagel-box.infra" 3600 "AAAA" ["2001:bc8:38ee:100:100::1"]) (dualProxyRecords "bagel-box.infra" 3600 "AAAA" ["2001:bc8:38ee:100:100::1"])
(record "gerrit01.infra" 3600 "AAAA" ["2001:bc8:38ee:100:1000::10"]) (dualProxyRecords "gerrit01.infra" 3600 "AAAA" ["2001:bc8:38ee:100:1000::10"])
(record "fodwatch.infra" 3600 "AAAA" ["2001:bc8:38ee:100:1000::30"]) (dualProxyRecords "fodwatch.infra" 3600 "AAAA" ["2001:bc8:38ee:100:1000::30"])
(record "meta01.infra" 3600 "AAAA" ["2001:bc8:38ee:100:1000::20"]) (dualProxyRecords "meta01.infra" 3600 "AAAA" ["2001:bc8:38ee:100:1000::20"])
(record "amqp" 3600 "CNAME" ["bagel-box.infra"]) (record "amqp" 3600 "CNAME" ["bagel-box.infra.p"])
(record "grafana" 3600 "CNAME" ["meta01.infra"]) (record "grafana" 3600 "CNAME" ["meta01.infra.p"])
(record "hydra" 3600 "CNAME" ["bagel-box.infra"]) (record "hydra" 3600 "CNAME" ["bagel-box.infra.p"])
(record "loki" 3600 "CNAME" ["meta01.infra"]) (record "loki" 3600 "CNAME" ["meta01.infra.p"])
(record "mimir" 3600 "CNAME" ["meta01.infra"]) (record "mimir" 3600 "CNAME" ["meta01.infra.p"])
(record "matrix" 3600 "CNAME" ["meta01.infra"]) (record "matrix" 3600 "CNAME" ["meta01.infra.p"])
(record "vpn-gw.wob01.infra" 3600 "AAAA" [ "2a01:584:11::2" ]) (record "vpn-gw.wob01.infra" 3600 "AAAA" [ "2a01:584:11::2" ])
# TODO: do not hardcode, just reuse the Colmena hive module outputs to generate all the required details. # TODO: do not hardcode, just reuse the Colmena hive module outputs to generate all the required details.