Skip to content

Commit

Permalink
Fix examples (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnonino authored Apr 9, 2024
1 parent 6fffbf9 commit 3e3c045
Showing 1 changed file with 50 additions and 12 deletions.
62 changes: 50 additions & 12 deletions examples/test/main.tf
Original file line number Diff line number Diff line change
@@ -1,39 +1,77 @@
locals {
public_subnet_ids = [for s in module.base-network.public_subnets : s.id]
private_subnet_ids = [for s in module.base-network.private_subnets : s.id]
}

module "cluster" {
source = "cn-terraform/ecs-cluster/aws"
name = "test-cluster"
name = "test"
}

module "base-network" {
source = "cn-terraform/networking/aws"
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"
cidr_block = "192.168.0.0/16"

vpc_additional_tags = {
vpc_tag1 = "tag1",
vpc_tag2 = "tag2",
}

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"
}
}

public_subnets_additional_tags = {
public_subnet_tag1 = "tag1",
public_subnet_tag2 = "tag2",
}

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"
}
}

private_subnets_additional_tags = {
private_subnet_tag1 = "tag1",
private_subnet_tag2 = "tag2",
}
}

module "td" {
source = "cn-terraform/ecs-fargate-task-definition/aws"
name_prefix = "test-td"
name_prefix = "test"
container_image = "ubuntu"
container_name = "test"
}

module "service" {
source = "cn-terraform/ecs-fargate-service/aws"
name_prefix = "test-service"
name_prefix = "test"
vpc_id = module.base-network.vpc_id
ecs_cluster_arn = module.cluster.aws_ecs_cluster_cluster_arn
task_definition_arn = module.td.aws_ecs_task_definition_td_arn
public_subnets = module.base-network.public_subnets_ids
private_subnets = module.base-network.private_subnets_ids
public_subnets = local.public_subnet_ids
private_subnets = local.private_subnet_ids
container_name = "test"
enable_autoscaling = false
}

module "ecs-service-autoscaling" {
source = "../../"
name_prefix = "test-as"
name_prefix = "test"
ecs_cluster_name = module.cluster.aws_ecs_cluster_cluster_name
ecs_service_name = module.service.aws_ecs_service_service_name
# region = "us-east-1"
Expand Down

0 comments on commit 3e3c045

Please sign in to comment.