Skip to content

developertown/terraform-aws-ecs-cluster

Repository files navigation

terraform-aws-ecs-cluster

Terraform module to provision an ECS Cluster.

Supports Amazon ECS Fargate capacity provider.

Usage

Basic

module "ecs_cluster" {
  source  = "../.."
  enabled = true

  name        = "example"
  environment = "test"

  container_insights_enabled      = true
  capacity_providers_fargate      = true
  capacity_providers_fargate_spot = true
}

Requirements

Name Version
terraform >= 1.3.3
aws ~> 4.36.1

Providers

Name Version
aws ~> 4.36.1

Modules

No modules.

Resources

Name Type
aws_ecs_cluster.default resource
aws_ecs_cluster_capacity_providers.default resource
aws_iam_instance_profile.default resource
aws_iam_role.default resource
aws_iam_role_policy_attachment.default resource
aws_iam_policy_document.assume data source
aws_partition.current data source

Inputs

Name Description Type Default Required
capacity_providers_fargate Use FARGATE capacity provider bool true no
capacity_providers_fargate_spot Use FARGATE_SPOT capacity provider bool false no
container_insights_enabled Whether or not to enable container insights bool true no
default_capacity_strategy The capacity provider strategy to use by default for the cluster
object({
base = object({
provider = string
value = number
})
weights = map(number)
})
{
"base": {
"provider": "FARGATE",
"value": 1
},
"weights": {}
}
no
enabled Set to false to prevent the module from creating any resources bool null no
environment ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' string null no
kms_key_id The AWS Key Management Service key ID to encrypt the data between the local client and the container. string null no
log_configuration The log configuration for the results of the execute command actions Required when logging is OVERRIDE
object({
cloud_watch_encryption_enabled = string
cloud_watch_log_group_name = string
s3_bucket_name = string
s3_key_prefix = string
})
null no
logging The AWS Key Management Service key ID to encrypt the data between the local client and the container. (Valid values: 'NONE', 'DEFAULT', 'OVERRIDE') string "DEFAULT" no
name ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a tag.
The "name" tag is set to the full id string. There is no tag with the value of the name input.
string "ecs-cluster" no
region The region in which the resources will be created string null no
role_arn The ARN of the role that will be assumed to create the resources in this module string null no
tags Additional tags (e.g. {'Unit': 'XYZ'}).
Neither the tag keys nor the tag values will be modified by this module.
map(string) {} no

Outputs

Name Description
arn ECS cluster arn
id ECS cluster id
name ECS cluster name
role_name IAM role name
<<<<<<< Updated upstream

=======