34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
local defaults = import "../config/defaults.libsonnet";
|
|
|
|
{
|
|
local rname (server, suffix) = "host_" + server.name + "_" + suffix,
|
|
|
|
HcloudInstance:: {
|
|
name: error "Instance must have field: name",
|
|
image: "debian-11",
|
|
server_type: error "Instance must have field: server_type",
|
|
location: "fsn1"
|
|
},
|
|
|
|
HcloudSSHKey:: {
|
|
name: error "Key must have field: name",
|
|
public_key: error "Key must have field: public_key"
|
|
},
|
|
|
|
HdnsRecord:: {
|
|
zone_id: "${hetznerdns_zone.infra.id}",
|
|
name: error "Record must have field: name",
|
|
value: error "Record must have field: value",
|
|
type: error "Record must have field: type",
|
|
ttl: defaults.defaultTTL
|
|
},
|
|
|
|
serverDnsRecords: function (s) {
|
|
local attr (s, n) = "${hcloud_server." + s.name + "." + n + "}",
|
|
|
|
[rname(s, "A")]: $.HdnsRecord{ name: s.networking.publicSubdomain, value: attr(s, "ipv4_address"), type: "A" },
|
|
[rname(s, "AAAA")]: $.HdnsRecord{ name: s.networking.publicSubdomain, value: attr(s, "ipv6_address"), type: "AAAA" },
|
|
[rname(s, "VPN")]: $.HdnsRecord{ name: s.networking.internalSubdomain, value: s.networking.wireguardIp, type: "AAAA" },
|
|
}
|
|
}
|