diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 59cd0a8..ab9aef2 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -38,7 +38,7 @@ jobs:
uses: actions/setup-python@v2
- name: Terraform min/max versions
id: minMax
- uses: clowdhaus/terraform-min-max@v1.0.1
+ uses: clowdhaus/terraform-min-max@v1.0.2
with:
directory: ${{ matrix.directory }}
- name: Install Terraform v${{ steps.minMax.outputs.minVersion }}
@@ -50,14 +50,11 @@ jobs:
- name: Execute pre-commit
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory != '.' }}
- run:
- pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*
+ run: pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*
- name: Execute pre-commit
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory == '.' }}
- run:
- pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)
-
+ run: pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)
# Max Terraform version
getBaseVersion:
@@ -68,7 +65,7 @@ jobs:
uses: actions/checkout@v2
- name: Terraform min/max versions
id: minMax
- uses: clowdhaus/terraform-min-max@v1.0.1
+ uses: clowdhaus/terraform-min-max@v1.0.2
outputs:
minVersion: ${{ steps.minMax.outputs.minVersion }}
maxVersion: ${{ steps.minMax.outputs.maxVersion }}
@@ -94,7 +91,7 @@ jobs:
- name: Install pre-commit dependencies
run: |
pip install pre-commit
- curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-v0.12\..+?-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
+ curl -Lo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.13.0/terraform-docs-v0.13.0-$(uname)-amd64.tar.gz && tar -xzf terraform-docs.tar.gz && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
- name: Execute pre-commit
# Run all pre-commit checks on max version supported
diff --git a/examples/complete/README.md b/examples/complete/README.md
index 4c5d4a8..fef0be8 100644
--- a/examples/complete/README.md
+++ b/examples/complete/README.md
@@ -34,6 +34,7 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Source | Version |
|------|--------|---------|
+| [ecs](#module\_ecs) | terraform-aws-modules/ecs/aws | ~> 3.0 |
| [eventbridge](#module\_eventbridge) | ../../ | |
| [step\_function](#module\_step\_function) | terraform-aws-modules/step-functions/aws | ~> 2.0 |
@@ -42,6 +43,8 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Type |
|------|------|
| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
+| [aws_ecs_service.hello_world](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service) | resource |
+| [aws_ecs_task_definition.hello_world](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition) | resource |
| [aws_kinesis_stream.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kinesis_stream) | resource |
| [aws_sqs_queue.dlq](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue) | resource |
| [aws_sqs_queue.fifo](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue) | resource |
diff --git a/examples/complete/main.tf b/examples/complete/main.tf
index d3ebc98..7f402b0 100644
--- a/examples/complete/main.tf
+++ b/examples/complete/main.tf
@@ -32,6 +32,9 @@ module "eventbridge" {
attach_cloudwatch_policy = true
cloudwatch_target_arns = [aws_cloudwatch_log_group.this.arn]
+ attach_ecs_policy = true
+ ecs_target_arns = [aws_ecs_task_definition.hello_world.arn]
+
rules = {
orders = {
description = "Capture all order data"
@@ -90,6 +93,15 @@ module "eventbridge" {
dead_letter_arn = aws_sqs_queue.dlq.arn
input_transformer = local.order_input_transformer
attach_role_arn = true
+ },
+ {
+ name = "process-email-with-ecs-task",
+ arn = module.ecs.ecs_cluster_arn,
+ attach_role_arn = true
+ ecs_target = {
+ task_count = 1
+ task_definition_arn = aws_ecs_task_definition.hello_world.arn
+ }
}
]
}
@@ -248,3 +260,43 @@ module "step_function" {
}
}
}
+
+######
+# ECS
+######
+
+module "ecs" {
+ source = "terraform-aws-modules/ecs/aws"
+ version = "~> 3.0"
+
+ name = random_pet.this.id
+
+ capacity_providers = ["FARGATE", "FARGATE_SPOT"]
+}
+
+resource "aws_ecs_service" "hello_world" {
+ name = "hello_world-${random_pet.this.id}"
+ cluster = module.ecs.ecs_cluster_id
+ task_definition = aws_ecs_task_definition.hello_world.arn
+ launch_type = "FARGATE"
+
+ desired_count = 1
+
+ deployment_maximum_percent = 100
+ deployment_minimum_healthy_percent = 0
+}
+
+resource "aws_ecs_task_definition" "hello_world" {
+ family = "hello_world-${random_pet.this.id}"
+
+ container_definitions = <