Skip to content

Instantly share code, notes, and snippets.

@cromyhector
Created May 31, 2022 05:34
Show Gist options
  • Select an option

  • Save cromyhector/204e9bb89a679eacaa5f92776340624e to your computer and use it in GitHub Desktop.

Select an option

Save cromyhector/204e9bb89a679eacaa5f92776340624e to your computer and use it in GitHub Desktop.
resource "aws_ecs_cluster" "cluster" {
name = "week20_ecs_cluster"
capacity_providers = ["FARGATE_SPOT", "FARGATE"]
default_capacity_provider_strategy {
capacity_provider = "FARGATE_SPOT"
}
setting {
name = "containerInsights"
value = "disabled"
}
}
module "ecs-fargate" {
source = "umotif-public/ecs-fargate/aws"
version = "~> 6.1.0"
name_prefix = "ecs-fargate-example"
vpc_id = aws_vpc.ecs_vpc.id
private_subnet_ids = [aws_subnet.private_subnet_1.id, aws_subnet.private_subnet_2.id]
cluster_id = aws_ecs_cluster.cluster.id
task_container_image = "centos"
task_definition_cpu = 256
task_definition_memory = 512
task_container_port = 80
task_container_assign_public_ip = true
load_balanced = false
target_groups = [
{
target_group_name = "tg-fargate-example"
container_port = 80
}
]
health_check = {
port = "traffic-port"
path = "/"
}
tags = {
Environment = "test"
Project = "Test"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment