From d3bbf284e81fa8730ce7c2bcc859ad68caa94d18 Mon Sep 17 00:00:00 2001 From: spypsy Date: Mon, 4 Dec 2023 11:31:35 +0000 Subject: [PATCH 1/3] fix(ci): terraform listener resources --- yarn-project/aztec-node/terraform/main.tf | 39 ++++++++------------ yarn-project/p2p-bootstrap/terraform/main.tf | 39 ++++++++------------ 2 files changed, 30 insertions(+), 48 deletions(-) diff --git a/yarn-project/aztec-node/terraform/main.tf b/yarn-project/aztec-node/terraform/main.tf index 4970090b8b2..f9052083d41 100644 --- a/yarn-project/aztec-node/terraform/main.tf +++ b/yarn-project/aztec-node/terraform/main.tf @@ -365,27 +365,18 @@ resource "aws_security_group_rule" "allow-node-tcp" { security_group_id = data.terraform_remote_state.aztec-network_iac.outputs.p2p_security_group_id } -## Commented out here and setup manually as terraform (or the aws provider version we are using) has a bug -## NLB listeners can't have a 'weight' property defined. You will see there isn't one here but that doesn't -## stop it trying to automatically specify one and giving an error - -# resource "aws_lb_listener" "aztec-node-tcp-listener" { -# count = local.node_count -# load_balancer_arn = data.terraform_remote_state.aztec-network_iac.outputs.nlb_arn -# port = var.NODE_TCP_PORT + count.index -# protocol = "TCP" - -# tags = { -# name = "aztec-node-${count.index}-tcp-listener" -# } - -# default_action { -# type = "forward" - -# forward { -# target_group { -# arn = aws_lb_target_group.aztec-bootstrap-target-group[count.index].arn -# } -# } -# } -# } +resource "aws_lb_listener" "aztec-node-tcp-listener" { + count = local.node_count + load_balancer_arn = data.terraform_remote_state.aztec-network_iac.outputs.nlb_arn + port = var.NODE_TCP_PORT + count.index + protocol = "TCP" + + tags = { + name = "aztec-node-${count.index}-tcp-listener" + } + + default_action { + type = "forward" + target_group_arn = aws_lb_target_group.aztec-bootstrap-target-group[count.index].arn + } +} diff --git a/yarn-project/p2p-bootstrap/terraform/main.tf b/yarn-project/p2p-bootstrap/terraform/main.tf index 43925bd5b29..cfa63547503 100644 --- a/yarn-project/p2p-bootstrap/terraform/main.tf +++ b/yarn-project/p2p-bootstrap/terraform/main.tf @@ -224,27 +224,18 @@ resource "aws_security_group_rule" "allow-bootstrap-tcp" { security_group_id = data.terraform_remote_state.aztec-network_iac.outputs.p2p_security_group_id } -## Commented out here and setup manually as terraform (or the aws provider version we are using) has a bug -## NLB listeners can't have a 'weight' property defined. You will see there isn't one here but that doesn't -## stop it trying to automatically specify one and giving an error - -# resource "aws_lb_listener" "aztec-bootstrap-tcp-listener" { -# count = local.bootnode_count -# load_balancer_arn = data.terraform_remote_state.aztec-network_iac.outputs.nlb_arn -# port = var.BOOTNODE_LISTEN_PORT + count.index -# protocol = "TCP" - -# tags = { -# name = "aztec-bootstrap-${count.index}-target-group" -# } - -# default_action { -# type = "forward" - -# forward { -# target_group { -# arn = aws_lb_target_group.aztec-bootstrap-target-group[count.index].arn -# } -# } -# } -# } +resource "aws_lb_listener" "aztec-bootstrap-tcp-listener" { + count = local.bootnode_count + load_balancer_arn = data.terraform_remote_state.aztec-network_iac.outputs.nlb_arn + port = var.BOOTNODE_LISTEN_PORT + count.index + protocol = "TCP" + + tags = { + name = "aztec-bootstrap-${count.index}-target-group" + } + + default_action { + type = "forward" + target_group_arn = aws_lb_target_group.aztec-bootstrap-target-group[count.index].arn + } +} From 8de5f50a5dad07f0ac500ddfdfde1e4b949ac956 Mon Sep 17 00:00:00 2001 From: spypsy Date: Mon, 4 Dec 2023 11:57:22 +0000 Subject: [PATCH 2/3] correct lb target group --- yarn-project/aztec-node/terraform/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/aztec-node/terraform/main.tf b/yarn-project/aztec-node/terraform/main.tf index f9052083d41..83fbfa405ea 100644 --- a/yarn-project/aztec-node/terraform/main.tf +++ b/yarn-project/aztec-node/terraform/main.tf @@ -377,6 +377,6 @@ resource "aws_lb_listener" "aztec-node-tcp-listener" { default_action { type = "forward" - target_group_arn = aws_lb_target_group.aztec-bootstrap-target-group[count.index].arn + target_group_arn = aws_lb_target_group.aztec-node-target-group[count.index].arn } } From a8541d3a3f4de5a5cfa5e847539fe2b0113a3d96 Mon Sep 17 00:00:00 2001 From: spypsy Date: Mon, 4 Dec 2023 12:42:39 +0000 Subject: [PATCH 3/3] force another CI build --- yarn-project/aztec-node/terraform/main.tf | 6 ------ 1 file changed, 6 deletions(-) diff --git a/yarn-project/aztec-node/terraform/main.tf b/yarn-project/aztec-node/terraform/main.tf index 83fbfa405ea..549ae6ba661 100644 --- a/yarn-project/aztec-node/terraform/main.tf +++ b/yarn-project/aztec-node/terraform/main.tf @@ -1,9 +1,3 @@ -# Terraform to setup a prototype network of Aztec Nodes in AWS -# It sets up 2 full nodes with different ports/keys etc. -# Some duplication across the 2 defined services, could possibly -# be refactored to use modules as and when we build out infrastructure for real - - terraform { backend "s3" { bucket = "aztec-terraform"