Skip to content

Latest commit

 

History

History
154 lines (124 loc) · 2.85 KB

aws_ecs_cluster.md

File metadata and controls

154 lines (124 loc) · 2.85 KB

aws_ecs_cluster

back

Index

Terraform

terraform {
  required_providers {
    aws = ">= 3.35.0"
  }
}

top

Example Usage

module "aws_ecs_cluster" {
  source = "./modules/aws/r/aws_ecs_cluster"

  # capacity_providers - (optional) is a type of set of string
  capacity_providers = []
  # name - (required) is a type of string
  name = null
  # tags - (optional) is a type of map of string
  tags = {}

  default_capacity_provider_strategy = [{
    base              = null
    capacity_provider = null
    weight            = null
  }]

  setting = [{
    name  = null
    value = null
  }]
}

top

Variables

variable "capacity_providers" {
  description = "(optional)"
  type        = set(string)
  default     = null
}

variable "name" {
  description = "(required)"
  type        = string
}

variable "tags" {
  description = "(optional)"
  type        = map(string)
  default     = null
}

variable "default_capacity_provider_strategy" {
  description = "nested block: NestingSet, min items: 0, max items: 0"
  type = set(object(
    {
      base              = number
      capacity_provider = string
      weight            = number
    }
  ))
  default = []
}

variable "setting" {
  description = "nested block: NestingSet, min items: 0, max items: 0"
  type = set(object(
    {
      name  = string
      value = string
    }
  ))
  default = []
}

top

Resource

resource "aws_ecs_cluster" "this" {
  # capacity_providers - (optional) is a type of set of string
  capacity_providers = var.capacity_providers
  # name - (required) is a type of string
  name = var.name
  # tags - (optional) is a type of map of string
  tags = var.tags

  dynamic "default_capacity_provider_strategy" {
    for_each = var.default_capacity_provider_strategy
    content {
      # base - (optional) is a type of number
      base = default_capacity_provider_strategy.value["base"]
      # capacity_provider - (required) is a type of string
      capacity_provider = default_capacity_provider_strategy.value["capacity_provider"]
      # weight - (optional) is a type of number
      weight = default_capacity_provider_strategy.value["weight"]
    }
  }

  dynamic "setting" {
    for_each = var.setting
    content {
      # name - (required) is a type of string
      name = setting.value["name"]
      # value - (required) is a type of string
      value = setting.value["value"]
    }
  }

}

top

Outputs

output "arn" {
  description = "returns a string"
  value       = aws_ecs_cluster.this.arn
}

output "id" {
  description = "returns a string"
  value       = aws_ecs_cluster.this.id
}

output "this" {
  value = aws_ecs_cluster.this
}

top