/terraform-aws-ecs-fargate-cluster

Terraform module for an ECS Fargate cluster

Primary LanguageHCLMIT LicenseMIT

Terraform module aws-ecs-fargate-cluster

This module deploys an ECS Fargate cluster in AWS.

Example:

module "ecs_cluster" {
  source             = "github.com/danbarr/terraform-aws-ecs-fargate-cluster?ref=v0.9.1"
  cluster_name       = "example-cluster"
  container_insights = true
}

Example using Fargate Spot as the default capacity provider, for reduced costs with interrupt-tolerant workloads:

module "ecs_cluster" {
  source            = "github.com/danbarr/terraform-aws-ecs-fargate-cluster?ref=v0.9.1"
  cluster_name      = "example-spot-cluster"
  capacity_provider = "FARGATE_SPOT"
}

(note, you can also supply FARGATE_SPOT as the capacity provider on a per-service basis)

Requirements

Name Version
terraform >= 1.1.0
aws >= 4.2

Providers

Name Version
aws 4.22.0

Modules

No modules.

Resources

Name Type
aws_ecs_cluster.this resource
aws_ecs_cluster_capacity_providers.default resource

Inputs

Name Description Type Default Required
cluster_name Name of the cluster (up to 255 letters, numbers, hyphens, and underscores). string n/a yes
container_insights Whether to enable CloudWatch Container Insights. bool false no
default_capacity_provider Capacity provider to use by default. Valid values are FARGATE and FARGATE_SPOT. string "FARGATE" no

Outputs

Name Description
cluster_arn ARN that identifies the cluster
cluster_id ID that identifies the cluster
cluster_name Name that identifies the cluster