AWS Elastic Container Service (ECS) Cluster for Application Terraform Module

Usage

Elastic Container Service (ECS) Cluster only:

module "my_app" {
  source = "ianrodrigues/ecs-app/aws"

  name    = "my-app"
  environ = "beta"

  capacity_providers = ["FARGATE", "FARGATE_SPOT"]

  tags = {
    "terraform" = "true"
  }
}

Elastic Container Service (ECS) Cluster and Application Load Balancer (ALB):

module "my_app" {
  source = "ianrodrigues/ecs-app/aws"

  name    = "my-app"
  environ = "beta"

  capacity_providers = ["FARGATE", "FARGATE_SPOT"]

  create_load_balancer = true

  vpc_id            = "vpc-abcde012"
  public_subnet_ids = ["subnet-abcde012", "subnet-bcde012a"]

  tags = {
    "terraform" = "true"
  }
}

Requirements

Name Version
terraform ~> 0.13
aws ~> 2.54
random ~> 2.3

Providers

Name Version
aws ~> 2.54
random ~> 2.3

Inputs

Name Description Type Default Required
capacity_provider_strategies (Optional) A list of capacity provider strategies.
list(object({
capacity_provider = string
weight = number
base = number
}))
[] no
capacity_providers (Optional) Key-value map of resource tags. list(string)
[
"FARGATE",
"FARGATE_SPOT"
]
no
create_load_balancer (Optional) Whether to create an AWS ALB (Application Load Balancer) as part of the application. bool true no
enable_container_insights (Optional) Whether to enable AWS ECS Container Insights. bool true no
environ Environment of the application. It will be used to name the resources of this module. string n/a yes
name Name of the application. It will be used to name the resources of this module. string n/a yes
public_subnet_ids (Optional) A list of Public Subnet IDs. It is required if "create_load_balancer" is "true". list(string) [] no
tags (Optional) Key-value map of resource tags. map(string) {} no
vpc_id (Optional) The VPC ID. It is required if "create_load_balancer" is "true". string "" no

Outputs

Name Description
this_app_security_group_id ID of the application Security Group.
this_cluster Name of the ECS cluster.
this_lb_arn ARN of the AWS ALB (Application Load Balancer).
this_lb_dns DNS name of the AWS ALB (Application Load Balancer).

Credits

License

The MIT License (MIT). Please see License File for more information.