mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 20:39:18 -08:00
Finish cleaning up terraform nomenclature for DNS and so on
This commit is contained in:
parent
81d5278809
commit
a452692daf
8 changed files with 32 additions and 109 deletions
|
|
@ -25,6 +25,7 @@ with lib;
|
|||
type = types.nullOr types.str;
|
||||
default = "";
|
||||
};
|
||||
isPublic = mkEnableOption "Provide DNS for the public primary IP addresses of the host";
|
||||
ipv4 = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,11 +25,14 @@ with lib;
|
|||
type = types.nullOr types.str;
|
||||
default = "";
|
||||
};
|
||||
isPublic = mkEnableOption "Provide DNS for the public primary IP addresses of the host";
|
||||
ipv4 = mkOption {
|
||||
type = types.str;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
ipv6 = mkOption {
|
||||
type = types.str;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -43,7 +46,20 @@ with lib;
|
|||
kw.dns.ipv4 = mkDefault (mkIf (tf.resources ? config.networking.hostName) (mkOptionDefault (config.deploy.tf.resources."${config.networking.hostName}".refAttr "ipv4_address")));
|
||||
kw.dns.ipv6 = mkDefault (mkIf (tf.resources ? config.networking.hostName) (mkOptionDefault (config.deploy.tf.resources."${config.networking.hostName}".refAttr "ipv6_address")));
|
||||
|
||||
# This is derived.
|
||||
# These are derived.
|
||||
kw.dns.domain = builtins.substring 0 ((builtins.stringLength config.kw.dns.tld) - 1) config.kw.dns.tld;
|
||||
|
||||
deploy.tf.dns.records = lib.mkIf (config.kw.dns.isPublic) {
|
||||
"node_${config.networking.hostName}_v4" = {
|
||||
tld = config.kw.dns.tld;
|
||||
domain = config.networking.hostName;
|
||||
a.address = config.kw.dns.ipv4;
|
||||
};
|
||||
"node_${config.networking.hostName}_v6" = {
|
||||
tld = config.kw.dns.tld;
|
||||
domain = config.networking.hostName;
|
||||
aaaa.address = config.kw.dns.ipv6;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue