Resource: aws_ecs_cluster

Provides an ECS cluster.

Example Usage

resource "aws_ecs_cluster" "foo" {
  name = "white-hart"

  setting {
    name  = "containerInsights"
    value = "enabled"
  }
}

Example with Log Configuration

resource "aws_kms_key" "example" {
  description             = "example"
  deletion_window_in_days = 7
}

resource "aws_cloudwatch_log_group" "example" {
  name = "example"
}

resource "aws_ecs_cluster" "test" {
  name = "example"

  configuration {
    execute_command_configuration {
      kms_key_id = aws_kms_key.example.arn
      logging    = "OVERRIDE"

      log_configuration {
        cloud_watch_encryption_enabled = true
        cloud_watch_log_group_name     = aws_cloudwatch_log_group.example.name
      }
    }
  }
}

Argument Reference

This resource supports the following arguments:

configuration

execute_command_configuration

log_configuration

setting

service_connect_defaults

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import ECS clusters using the name. For example:

import {
  to = aws_ecs_cluster.stateless
  id = "stateless-app"
}

Using terraform import, import ECS clusters using the name. For example:

% terraform import aws_ecs_cluster.stateless stateless-app