terraform: add all DNS A and AAAA records
zimbatm committed
Oct 4, 2021 at 13:49 UTC
b484b46509516c757e0a36104ce3348db9300423
1 file changed
+89
-2
terraform/dns.tf
+89
-2
@@ -3,6 +3,79 @@
3
locals {
4
# Shortcut to keep this a bit leaner
5
zone_id = netlify_dns_zone.nixos.id
6
+
7
+ dns_records = [
8
+ {
9
+ hostname = "bastion.nixos.org"
10
+ type = "A"
11
+ value = "34.254.208.229"
12
+ },
13
+ {
14
+ hostname = "ceres.nixos.org"
15
+ type = "A"
16
+ value = "46.4.66.184"
17
+ },
18
+ {
19
+ hostname = "ceres.nixos.org"
20
+ type = "AAAA"
21
+ value = "2a01:4f8:140:244c::"
22
+ },
23
+ {
24
+ hostname = "haumea.nixos.org"
25
+ type = "A"
26
+ value = "46.4.89.205"
27
+ },
28
+ {
29
+ hostname = "haumea.nixos.org"
30
+ type = "AAAA"
31
+ value = "2a01:4f8:140:72cf::"
32
+ },
33
+ {
34
+ hostname = "hydra.ngi0.nixos.org"
35
+ type = "A"
36
+ value = "116.202.113.248"
37
+ },
38
+ {
39
+ hostname = "hydra.ngi0.nixos.org"
40
+ type = "AAAA"
41
+ value = "2a01:4f8:231:4187::"
42
+ },
43
+ {
44
+ hostname = "hydra.nixos.org"
45
+ type = "A"
46
+ value = "46.4.66.184"
47
+ },
48
+ {
49
+ hostname = "hydra.nixos.org"
50
+ type = "AAAA"
51
+ value = "2a01:4f8:140:244c::"
52
+ },
53
+ {
54
+ hostname = "monitoring.nixos.org"
55
+ type = "A"
56
+ value = "138.201.32.77"
57
+ },
58
+ {
59
+ hostname = "planet.nixos.org"
60
+ type = "A"
61
+ value = "54.217.220.47"
62
+ },
63
+ {
64
+ hostname = "status.nixos.org"
65
+ type = "A"
66
+ value = "138.201.32.77"
67
+ },
68
+ {
69
+ hostname = "survey.nixos.org"
70
+ type = "A"
71
+ value = "78.47.220.153"
72
+ },
73
+ {
74
+ hostname = "survey.nixos.org"
75
+ type = "AAAA"
76
+ value = "2a01:4f8:c0c:6e2c::1"
77
+ },
78
+ ]
79
}
80
81
resource "netlify_dns_zone" "nixos" {
@@ -10,14 +83,28 @@ resource "netlify_dns_zone" "nixos" {
83
name = "nixos.org"
84
}
85
13
-# Import fails with:
86
+# Import fails on all types with:
87
#
88
# Error: &{0 } (*models.Error) is not supported by the TextConsumer, can be resolved by supporting TextUnmarshaler interface
89
#
17
-# resource "netlify_dns_record" "test" {
90
+# resource "netlify_dns_record" "nixos" {
91
# zone_id = local.zone_id
92
#
93
# hostname = "nixos.org"
94
# type = "NETLIFY"
95
# value = "nixos-homepage.netlify.com"
96
# }
97
+#
98
+# New entries can be created if they are not of NETLIFY type.
99
+#
100
+# TTL is not supported.
101
+
102
+# netlify api getDnsRecords -d '{ "zone_id": "5e6ce1b8b6f808aa16acd1ff" }'
103
+
104
+resource "netlify_dns_record" "nixos" {
105
+ for_each = { for v in local.dns_records : "${v.hostname}-${v.type}" => v }
106
+ zone_id = local.zone_id
107
+ hostname = each.value.hostname
108
+ type = each.value.type
109
+ value = each.value.value
110
+}