Skip to content

Commit

Permalink
Set default placement strategy options
Browse files Browse the repository at this point in the history
  • Loading branch information
qbart committed Jul 13, 2022
1 parent 1254e54 commit 99285ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/ecs-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ resource "aws_ecs_cluster" "this" {
}

resource "aws_placement_group" "this" {
name = random_id.prefix.hex
strategy = "spread" # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html
name = random_id.prefix.hex
strategy = var.placement_group.strategy # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html
spread_level = var.placement_group.spread_level

tags = var.tags
}
Expand Down
13 changes: 13 additions & 0 deletions modules/ecs-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,16 @@ variable "root_block_configuration" {
}
description = "Configuration for root block device block."
}

variable "placement_group" {
description = "Placement group strategy."

type = object({
strategy = string
spread_level = string
})
default = {
strategy = "spread"
spread_level = "rack"
}
}

0 comments on commit 99285ad

Please sign in to comment.