Skip to content

Commit 71a88ba

Browse files
committed
aws: Add each test instance to the local DNS service
The kdevops NFS workflows typically set up separate nodes for an NFS server and NFS clients. kdevops then provisions exports on the NFS server and mount points on the clients. For libvirt, kdevops adds the IP address of each test node to all of the /etc/hosts files. This enables the clients to mount the test NFS server conveniently by hostname. For AWS, kdevops can provision a private DNS service and add "A" records for each test host there. This patch implements that approach. Tested-by: Luis Chamberlain <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 13b42e7 commit 71a88ba

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

terraform/aws/main.tf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,33 @@ resource "aws_route_table_association" "kdevops_rt_assoc" {
184184
route_table_id = aws_route_table.kdevops_rt.id
185185
}
186186

187+
resource "aws_vpc_dhcp_options" "kdevops_dhcp_opts" {
188+
domain_name = "kdevops.local"
189+
domain_name_servers = ["AmazonProvidedDNS"]
190+
191+
tags = {
192+
Name = "kdevops_dhcp_opts"
193+
}
194+
}
195+
196+
resource "aws_vpc_dhcp_options_association" "kdevops_dhcp_association" {
197+
vpc_id = aws_vpc.kdevops_vpc.id
198+
dhcp_options_id = aws_vpc_dhcp_options.kdevops_dhcp_opts.id
199+
}
200+
201+
resource "aws_route53_zone" "kdevops_private_zone" {
202+
name = "kdevops.local"
203+
vpc {
204+
vpc_id = aws_vpc.kdevops_vpc.id
205+
}
206+
}
207+
208+
resource "aws_route53_record" "kdevops_dns_record" {
209+
count = local.kdevops_num_boxes
210+
zone_id = aws_route53_zone.kdevops_private_zone.zone_id
211+
name = "${element(var.kdevops_nodes, count.index)}.kdevops.local"
212+
type = "A"
213+
ttl = "300"
214+
records = ["${element(aws_instance.kdevops_instance.*.private_ip, count.index)}"]
215+
}
216+

0 commit comments

Comments
 (0)