From 8e9eeba8ecc32fbbf535fdf6df08e7ea60de8fab Mon Sep 17 00:00:00 2001 From: Julian Nonino Date: Mon, 23 Jun 2025 23:39:50 +0100 Subject: [PATCH] Update networking module --- examples/test/main.tf | 51 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/examples/test/main.tf b/examples/test/main.tf index 145a1de..6903979 100644 --- a/examples/test/main.tf +++ b/examples/test/main.tf @@ -1,11 +1,46 @@ module "base-network" { - source = "cn-terraform/networking/aws" - version = "2.0.13" - name_prefix = "test-networking" - vpc_cidr_block = "192.168.0.0/16" - availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d"] - public_subnets_cidrs_per_availability_zone = ["192.168.0.0/19", "192.168.32.0/19", "192.168.64.0/19", "192.168.96.0/19"] - private_subnets_cidrs_per_availability_zone = ["192.168.128.0/19", "192.168.160.0/19", "192.168.192.0/19", "192.168.224.0/19"] + source = "cn-terraform/networking/aws" + version = "3.0.0" + + cidr_block = "192.168.0.0/16" + + public_subnets = { + first_public_subnet = { + availability_zone = "us-east-1a" + cidr_block = "192.168.0.0/19" + } + second_public_subnet = { + availability_zone = "us-east-1b" + cidr_block = "192.168.32.0/19" + } + third_public_subnet = { + availability_zone = "us-east-1c" + cidr_block = "192.168.64.0/19" + } + fourth_public_subnet = { + availability_zone = "us-east-1d" + cidr_block = "192.168.96.0/19" + } + } + + private_subnets = { + first_private_subnet = { + availability_zone = "us-east-1a" + cidr_block = "192.168.128.0/19" + } + second_private_subnet = { + availability_zone = "us-east-1b" + cidr_block = "192.168.160.0/19" + } + third_private_subnet = { + availability_zone = "us-east-1c" + cidr_block = "192.168.192.0/19" + } + fourth_private_subnet = { + availability_zone = "us-east-1d" + cidr_block = "192.168.224.0/19" + } + } } module "cluster" { @@ -28,7 +63,7 @@ module "task" { event_rule_name = "test-rule" event_rule_schedule_expression = "cron(0 20 * * ? *)" ecs_cluster_arn = module.cluster.aws_ecs_cluster_cluster_arn - event_target_ecs_target_subnets = module.base-network.public_subnets_ids + event_target_ecs_target_subnets = [for subnet in module.base-network.public_subnets : subnet.id] event_target_ecs_target_task_definition_arn = module.td.aws_ecs_task_definition_td_arn ecs_execution_task_role_arn = "Put your execution role ARN here" ecs_task_role_arn = "Put your role ARN here"