diff mbox series

[RFC,2/2] aws: Add each test instance to the local DNS service

Message ID 20241108201245.561269-3-cel@kernel.org (mailing list archive)
State New
Headers show
Series Provisioning the AWS private network | expand

Checks

Context Check Description
mcgrof/vmtest-main-PR success PR summary
mcgrof/vmtest-main-VM_Test-4 success Logs for Setup and Run Make Targets (debian:testing)
mcgrof/vmtest-main-VM_Test-9 success Logs for Setup and Run Make Targets (opensuse/tumbleweed)
mcgrof/vmtest-main-VM_Test-6 success Logs for Setup and Run Make Targets (fedora:latest)
mcgrof/vmtest-main-VM_Test-5 success Logs for Setup and Run Make Targets (debian:testing)
mcgrof/vmtest-main-VM_Test-11 success Logs for Setup and Run Make Targets (opensuse/tumbleweed)
mcgrof/vmtest-main-VM_Test-3 success Logs for Setup and Run Make Targets (debian:testing)
mcgrof/vmtest-main-VM_Test-8 success Logs for Setup and Run Make Targets (fedora:latest)
mcgrof/vmtest-main-VM_Test-10 success Logs for Setup and Run Make Targets (opensuse/tumbleweed)
mcgrof/vmtest-main-VM_Test-7 success Logs for Setup and Run Make Targets (fedora:latest)
mcgrof/vmtest-main-VM_Test-2 success Logs for Run kdevops CI
mcgrof/vmtest-main-VM_Test-1 success Logs for Run kdevops CI
mcgrof/vmtest-main-VM_Test-0 success Logs for Run kdevops CI

Commit Message

Chuck Lever Nov. 8, 2024, 8:12 p.m. UTC
From: Chuck Lever <chuck.lever@oracle.com>

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.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 terraform/aws/main.tf | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff mbox series

Patch

diff --git a/terraform/aws/main.tf b/terraform/aws/main.tf
index 62730d77422c..77aabd79e658 100644
--- a/terraform/aws/main.tf
+++ b/terraform/aws/main.tf
@@ -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)}"]
+}
+