Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix examples #33

Merged
merged 3 commits into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading