Skip to content

aws.ecs-cluster resource

Description

Cluster manages an ECS cluster. The name is the only input fixed at create time, so changing it replaces the cluster; every other input is reconciled in place. The configuration, service connect defaults, and settings are reconciled by UpdateCluster when they change, and tags by the tag calls. The capacity-providers and default-capacity-provider-strategy fields have no member in the update call: they are reconciled by the whole-state PutClusterCapacityProviders call after create and on any later change, each call replacing both sets together, so removing either field from the configuration clears its set on the cluster.

Name is required, since an omitted name would silently address the cluster literally named "default". It must match ^[0-9A-Za-z_-]{1,255}$, a regular-expression and byte-length check enforced in Create rather than a declarative constraint.

Source: internal/service/ecs/cluster_rsrc.go:64

Example usage:

imports: {
  aws: 'github.com/cloudboss/unobin-library-aws'
}

resources: {
  example: aws.ecs-cluster {
    # Set input fields here.
  }
}

Inputs

name

string

required

configuration

optional(object)
optional(
  object({
    execute-command-configuration: optional(
      object({
        kms-key-id: optional(string)
        logging: optional(string)
        log-configuration: optional(
          object({
            cloud-watch-encryption-enabled: optional(boolean)
            cloud-watch-log-group-name: optional(string)
            s3-bucket-name: optional(string)
            s3-encryption-enabled: optional(boolean)
            s3-key-prefix: optional(string)
          })
        )
      })
    )
    managed-storage-configuration: optional(
      object({
        kms-key-id: optional(string)
        fargate-ephemeral-storage-kms-key-id: optional(string)
      })
    )
  })
)

service-connect-defaults

optional(object)
optional(
  object({
    namespace: string
  })
)

settings

list(object)
list(
  object({
    name: string
    value: string
  })
)

capacity-providers

list(string)

default-capacity-provider-strategy

list(object)
list(
  object({
    capacity-provider: string
    base: optional(integer)
    weight: optional(integer)
  })
)

tags

map(string)

Input Constraints

Configuration rules

logging must be one of NONE, DEFAULT, or OVERRIDE.

Rule logic
When
input.configuration.execute-command-configuration.logging != null
Require
input.configuration.execute-command-configuration.logging == 'NONE'
|| input.configuration.execute-command-configuration.logging == 'DEFAULT'
|| input.configuration.execute-command-configuration.logging == 'OVERRIDE'

log-configuration is required when logging is OVERRIDE.

Rule logic
When
input.configuration.execute-command-configuration.logging == 'OVERRIDE'
Require
input.configuration.execute-command-configuration.log-configuration != null

Settings rules

name must be containerInsights.

Rule logic
For each
input.settings
Require
@each.value.name == 'containerInsights'

Default capacity provider strategy rules

base must be between 0 and 100000.

Rule logic
For each
input.default-capacity-provider-strategy
When
@each.value.base != null
Require
(@each.value.base == null || @each.value.base >= 0)
&& (@each.value.base == null || @each.value.base <= 100000)

weight must be between 0 and 1000.

Rule logic
For each
input.default-capacity-provider-strategy
When
@each.value.weight != null
Require
(@each.value.weight == null || @each.value.weight >= 0)
&& (@each.value.weight == null || @each.value.weight <= 1000)

Outputs

arn

string