Skip to content

Instantly share code, notes, and snippets.

@jaabanks
Last active March 11, 2024 18:56
Show Gist options
  • Save jaabanks/c7070fd39e0ae692b381c4814d07ab47 to your computer and use it in GitHub Desktop.
Save jaabanks/c7070fd39e0ae692b381c4814d07ab47 to your computer and use it in GitHub Desktop.

Revisions

  1. jaabanks renamed this gist Sep 28, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. jaabanks created this gist Sep 28, 2021.
    51 changes: 51 additions & 0 deletions project18-main.tf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    resource "aws_ecs_cluster" "cluster" {
    name = "project-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 = "vpc-a28be9df"
    private_subnet_ids = ["subnet-e90052b6"]

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