Skip to content

Commit

Permalink
Updated capacity provider config (fixes issue with destroy)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Fortuna committed Mar 25, 2022
1 parent 796f28e commit 575b634
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TERRAFORM_VERSION=1.1.0
TERRAFORM_VERSION=1.1.7
AWS_DEFAULT_REGION?=ap-southeast-2

ifneq (, $(shell which docker))
Expand Down
24 changes: 14 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@
* ![AWS ECS Cluster](aws_ecs_cluster.png)
*/
resource "aws_ecs_cluster" "cluster" {
name = var.name
capacity_providers = var.capacity_providers

dynamic "default_capacity_provider_strategy" {
for_each = var.default_capacity_provider != null ? [1] : []
content {
capacity_provider = var.default_capacity_provider
weight = 100
}
}
name = var.name

#checkov:skip=CKV_AWS_65:Dynamic container insights
setting {
Expand All @@ -32,3 +23,16 @@ resource "aws_ecs_cluster" "cluster" {
},
)
}

resource "aws_ecs_cluster_capacity_providers" "capacity_providers" {
cluster_name = aws_ecs_cluster.cluster.name
capacity_providers = var.capacity_providers

dynamic "default_capacity_provider_strategy" {
for_each = var.default_capacity_provider != null ? [1] : []
content {
capacity_provider = var.default_capacity_provider
weight = 100
}
}
}

0 comments on commit 575b634

Please sign in to comment.