From cde2c50083e711ba0d9999dd65df04a0fc54e250 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Wed, 29 Jul 2026 17:32:30 +0200 Subject: [PATCH 1/2] run_t_clients.sh: Fix limited TESTGROUPS runs The old code only worked for sequences of TESTGROUPS that started at 1 and had no holes. We're already forcing bash, so use associative array feature to store the JOBS information better. Signed-off-by: Frank Lichtenheld --- t_server/original/run_t_clients.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/t_server/original/run_t_clients.sh b/t_server/original/run_t_clients.sh index d5ec1b8..b54b8a8 100755 --- a/t_server/original/run_t_clients.sh +++ b/t_server/original/run_t_clients.sh @@ -27,19 +27,19 @@ EOF for T in $TESTSETS do echo "$T..." - JOBS="" + declare -A JOBS=() for G in $TESTGROUPS do LOG=$LOGDIR/$DAY/$NOW.$T.$G.out echo "Starting $T/$G..." ssh -i "$KEY" "$HOST" "TEST_RUN_OVERRIDE='${TEST_RUN_OVERRIDE:-}' TEST_RUN_GROUP=$G ./bin/t_client.sh $T" >"$LOG" 2>&1 & - JOBS="$JOBS $!" + JOBS[$G]=$! done echo "$T..." >> $SUMMARY - G=1 - for J in $JOBS + for G in $TESTGROUPS do + J=${JOBS[$G]} LOG=$LOGDIR/$DAY/$NOW.$T.$G.out echo "Waiting for $T/$G (pid=$J)..." @@ -65,7 +65,6 @@ do echo "" exit 1 esac - G=$((G + 1)) done done From a4df3d091e906257db1c8eb4b9ccd556c906eb14 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Wed, 29 Jul 2026 17:34:00 +0200 Subject: [PATCH 2/2] openvpn_test_env: Make it easier to run multiple setups in the same account - Allow to rename the VPC if manage_vpc is true - Actually use the deployment variable to name things I decided to not use "deployment" for the vpc name directly though often you will probably want to sync them. Still it might be useful to not conflate them. Signed-off-by: Frank Lichtenheld --- t_server/tofu/openvpn_test_env/input.auto.tfvars.sample | 6 +++++- t_server/tofu/openvpn_test_env/main.tf | 2 +- t_server/tofu/openvpn_test_env/sg.tf | 8 ++++---- t_server/tofu/openvpn_test_env/tserver_anchor.tf | 3 ++- t_server/tofu/openvpn_test_env/tserver_client.tf | 3 ++- t_server/tofu/openvpn_test_env/tserver_rocky_9_amd64.tf | 3 ++- t_server/tofu/openvpn_test_env/tserver_sg.tf | 4 ++-- t_server/tofu/openvpn_test_env/variables.tf | 8 +++++++- 8 files changed, 25 insertions(+), 12 deletions(-) diff --git a/t_server/tofu/openvpn_test_env/input.auto.tfvars.sample b/t_server/tofu/openvpn_test_env/input.auto.tfvars.sample index 8e8940c..ab61e17 100644 --- a/t_server/tofu/openvpn_test_env/input.auto.tfvars.sample +++ b/t_server/tofu/openvpn_test_env/input.auto.tfvars.sample @@ -29,6 +29,9 @@ external_primary_vpc_id = "vpc-abcdef0123456789a" external_primary_vpc_primary_public_subnet_id = "subnet-cdef0123456789abc" external_primary_vpc_primary_public_route_table_id = "rtb-f0123456789abcdef012" +# if you set manage_vpc to true, you can change the name of the VPC +vpc_name = "production" + ### VPC settings # # Only required when this module manages the VPC @@ -79,7 +82,8 @@ private_dns_zone_name = "tserver.vpn" # t_server VPN CIDR block tserver_rocky_9_amd64_vpn_cidr_block = "10.52.124.0/24" -# This gets added to AWS tags and is purely informal +# This gets added to AWS name tags to make resources from different deployments +# easier to differentiate deployment = "production" # Hostnames for the t_server EC2 instances; these will be added to private DNS diff --git a/t_server/tofu/openvpn_test_env/main.tf b/t_server/tofu/openvpn_test_env/main.tf index 06030d1..57c36f8 100644 --- a/t_server/tofu/openvpn_test_env/main.tf +++ b/t_server/tofu/openvpn_test_env/main.tf @@ -6,7 +6,7 @@ module "ami" { module "primary-vpc" { count = var.manage_vpc ? 1 : 0 source = "github.com/Puppet-Finland/opentofu-vpc?ref=1.1.0" - basename = "production" + basename = var.vpc_name region = var.region manage_ipv4_nat_gateway = false vpc_cidr_block = var.primary_vpc_cidr_block diff --git a/t_server/tofu/openvpn_test_env/sg.tf b/t_server/tofu/openvpn_test_env/sg.tf index 1b88274..7d613a8 100644 --- a/t_server/tofu/openvpn_test_env/sg.tf +++ b/t_server/tofu/openvpn_test_env/sg.tf @@ -1,6 +1,6 @@ module "primary-vpc-standard-sg" { source = "github.com/Puppet-Finland/opentofu-sg-standard?ref=1.1.0" - basename = "production" + basename = var.deployment vpc_id = local.primary_vpc_id allow_ssh_cidr_blocks = [local.primary_vpc_cidr_block] allow_ssh_ipv6_cidr_blocks = ["::1/128", local.primary_vpc_ipv6_cidr_block] @@ -31,18 +31,18 @@ resource "aws_security_group_rule" "allow_ssh_from_any_ipv6" { module "primary-vpc-webserver-public-sg" { source = "github.com/Puppet-Finland/opentofu-sg-webserver?ref=1.0.0" - basename = "production" + basename = var.deployment vpc_id = local.primary_vpc_id type = "public" } resource "aws_security_group" "webcache" { - name = "webcache" + name = "${var.deployment}-webcache" description = "Allow access to TCP on ports 8080-8090" vpc_id = local.primary_vpc_id tags = { - Name = "webcache" + Name = "${var.deployment}-webcache" } } diff --git a/t_server/tofu/openvpn_test_env/tserver_anchor.tf b/t_server/tofu/openvpn_test_env/tserver_anchor.tf index a14620c..f4b6589 100644 --- a/t_server/tofu/openvpn_test_env/tserver_anchor.tf +++ b/t_server/tofu/openvpn_test_env/tserver_anchor.tf @@ -7,8 +7,9 @@ resource "aws_instance" "tserver_anchor" { key_name = var.key_name source_dest_check = false subnet_id = local.primary_vpc_primary_public_subnet_id - tags = { "Name" : "tserver-anchor", + tags = { "Name" : "${var.deployment}-tserver-anchor", "Role" : "Static tserver OpenVPN client", + "Deployment" : var.deployment, "tostop" : "true", "Distro" : "Rocky", "Login" : "rocky" } diff --git a/t_server/tofu/openvpn_test_env/tserver_client.tf b/t_server/tofu/openvpn_test_env/tserver_client.tf index 674e91e..217fc76 100644 --- a/t_server/tofu/openvpn_test_env/tserver_client.tf +++ b/t_server/tofu/openvpn_test_env/tserver_client.tf @@ -7,8 +7,9 @@ resource "aws_instance" "tserver_client" { key_name = var.key_name source_dest_check = false subnet_id = local.primary_vpc_primary_public_subnet_id - tags = { "Name" : "tserver-client", + tags = { "Name" : "${var.deployment}-tserver-client", "Role" : "Static tserver OpenVPN client", + "Deployment" : var.deployment, "tostop" : "true", "Distro" : "Rocky", "Login" : "rocky" } diff --git a/t_server/tofu/openvpn_test_env/tserver_rocky_9_amd64.tf b/t_server/tofu/openvpn_test_env/tserver_rocky_9_amd64.tf index 7dcf5bb..3b10068 100644 --- a/t_server/tofu/openvpn_test_env/tserver_rocky_9_amd64.tf +++ b/t_server/tofu/openvpn_test_env/tserver_rocky_9_amd64.tf @@ -7,8 +7,9 @@ resource "aws_instance" "tserver_rocky_9_amd64" { key_name = var.key_name source_dest_check = false subnet_id = local.primary_vpc_primary_public_subnet_id - tags = { "Name" : "tserver-rocky-9-amd64", + tags = { "Name" : "${var.deployment}-tserver-rocky-9-amd64", "Role" : "tserver", + "Deployment" : var.deployment, "tostop" : "true", "Distro" : "Rocky", "Login" : "rocky" } diff --git a/t_server/tofu/openvpn_test_env/tserver_sg.tf b/t_server/tofu/openvpn_test_env/tserver_sg.tf index ef1dba5..582ff2b 100644 --- a/t_server/tofu/openvpn_test_env/tserver_sg.tf +++ b/t_server/tofu/openvpn_test_env/tserver_sg.tf @@ -1,10 +1,10 @@ resource "aws_security_group" "tserver" { - name = "tserver" + name = "${var.deployment}-tserver" description = "Allow access to OpenVPN ports" vpc_id = local.primary_vpc_id tags = { - Name = "tserver" + Name = "${var.deployment}-tserver" } } diff --git a/t_server/tofu/openvpn_test_env/variables.tf b/t_server/tofu/openvpn_test_env/variables.tf index 6a93e14..b99a865 100644 --- a/t_server/tofu/openvpn_test_env/variables.tf +++ b/t_server/tofu/openvpn_test_env/variables.tf @@ -23,6 +23,12 @@ variable "manage_vpc" { default = true } +variable "vpc_name" { + description = "How to name the VPC (only if manage_vpc=true)" + type = string + default = "production" +} + # Parameters variable "public_dns_zone_name" { description = "Public Route 53 hosted zone name. Required when enable_public_dns_zone is true." @@ -35,7 +41,7 @@ variable "private_dns_zone_name" { } variable "deployment" { - description = "Informal deployment name added to EC2 instance tags" + description = "Deployment name added to EC2 resource names" type = string }