From bff70b384a337ed0a5f2254c08cd937c7a4ba90c Mon Sep 17 00:00:00 2001
From: Stewart Campbell <78276883+stewartcampbell@users.noreply.github.com>
Date: Fri, 18 Mar 2022 14:46:23 +0000
Subject: [PATCH] feat: Add aws_ecs_cluster_capacity_providers resource (#55)
---
README.md | 5 +++--
examples/complete-ecs/README.md | 4 ++--
examples/complete-ecs/versions.tf | 2 +-
main.tf | 20 +++++++++++++-------
versions.tf | 2 +-
5 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index fab8052..24a9a70 100644
--- a/README.md
+++ b/README.md
@@ -58,13 +58,13 @@ module "ecs" {
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.13.1 |
-| [aws](#requirement\_aws) | >= 2.48 |
+| [aws](#requirement\_aws) | >= 3.74 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 2.48 |
+| [aws](#provider\_aws) | >= 3.74 |
## Modules
@@ -75,6 +75,7 @@ No modules.
| Name | Type |
|------|------|
| [aws_ecs_cluster.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster) | resource |
+| [aws_ecs_cluster_capacity_providers.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster_capacity_providers) | resource |
## Inputs
diff --git a/examples/complete-ecs/README.md b/examples/complete-ecs/README.md
index ead0ec7..f17a3f4 100644
--- a/examples/complete-ecs/README.md
+++ b/examples/complete-ecs/README.md
@@ -44,13 +44,13 @@ Current version creates an high-available VPC with instances that are attached t
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.13.1 |
-| [aws](#requirement\_aws) | >= 2.48 |
+| [aws](#requirement\_aws) | >= 3.74 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 2.48 |
+| [aws](#provider\_aws) | >= 3.74 |
## Modules
diff --git a/examples/complete-ecs/versions.tf b/examples/complete-ecs/versions.tf
index 5e5c16f..538b915 100644
--- a/examples/complete-ecs/versions.tf
+++ b/examples/complete-ecs/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 2.48"
+ version = ">= 3.74"
}
}
}
diff --git a/main.tf b/main.tf
index 0a707dc..76badad 100644
--- a/main.tf
+++ b/main.tf
@@ -3,6 +3,19 @@ resource "aws_ecs_cluster" "this" {
name = var.name
+ setting {
+ name = "containerInsights"
+ value = var.container_insights ? "enabled" : "disabled"
+ }
+
+ tags = var.tags
+}
+
+resource "aws_ecs_cluster_capacity_providers" "this" {
+ count = var.create_ecs ? 1 : 0
+
+ cluster_name = aws_ecs_cluster.this[0].name
+
capacity_providers = var.capacity_providers
dynamic "default_capacity_provider_strategy" {
@@ -15,11 +28,4 @@ resource "aws_ecs_cluster" "this" {
base = lookup(strategy.value, "base", null)
}
}
-
- setting {
- name = "containerInsights"
- value = var.container_insights ? "enabled" : "disabled"
- }
-
- tags = var.tags
}
diff --git a/versions.tf b/versions.tf
index 5e5c16f..538b915 100644
--- a/versions.tf
+++ b/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 2.48"
+ version = ">= 3.74"
}
}
}