Skip to content

Commit

Permalink
aws: Add each test instance to the local DNS service
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
chucklever committed Nov 9, 2024
1 parent 13b42e7 commit 71a88ba
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions terraform/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,33 @@ resource "aws_route_table_association" "kdevops_rt_assoc" {
route_table_id = aws_route_table.kdevops_rt.id
}

resource "aws_vpc_dhcp_options" "kdevops_dhcp_opts" {
domain_name = "kdevops.local"
domain_name_servers = ["AmazonProvidedDNS"]

tags = {
Name = "kdevops_dhcp_opts"
}
}

resource "aws_vpc_dhcp_options_association" "kdevops_dhcp_association" {
vpc_id = aws_vpc.kdevops_vpc.id
dhcp_options_id = aws_vpc_dhcp_options.kdevops_dhcp_opts.id
}

resource "aws_route53_zone" "kdevops_private_zone" {
name = "kdevops.local"
vpc {
vpc_id = aws_vpc.kdevops_vpc.id
}
}

resource "aws_route53_record" "kdevops_dns_record" {
count = local.kdevops_num_boxes
zone_id = aws_route53_zone.kdevops_private_zone.zone_id
name = "${element(var.kdevops_nodes, count.index)}.kdevops.local"
type = "A"
ttl = "300"
records = ["${element(aws_instance.kdevops_instance.*.private_ip, count.index)}"]
}

0 comments on commit 71a88ba

Please sign in to comment.