From ba661aae92737177b21ecb3a02cb2615ad1034b5 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sat, 22 Apr 2023 08:22:19 -0400 Subject: [PATCH 1/7] update ecs_target parameters --- README.md | 4 +-- examples/with-ecs-scheduling/main.tf | 29 +++++++++++++++++-- main.tf | 42 ++++++++++++++++++++++++---- versions.tf | 2 +- 4 files changed, 66 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 073cb94..647b0b3 100644 --- a/README.md +++ b/README.md @@ -357,13 +357,13 @@ module "eventbridge" { | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13.1 | -| [aws](#requirement\_aws) | >= 4.7 | +| [aws](#requirement\_aws) | >= 4.64 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.7 | +| [aws](#provider\_aws) | >= 4.64 | ## Modules diff --git a/examples/with-ecs-scheduling/main.tf b/examples/with-ecs-scheduling/main.tf index 08bad27..7d73de8 100644 --- a/examples/with-ecs-scheduling/main.tf +++ b/examples/with-ecs-scheduling/main.tf @@ -57,15 +57,38 @@ module "eventbridge" { attach_role_arn = true ecs_target = { - launch_type = "FARGATE" - task_count = 1 - task_definition_arn = aws_ecs_task_definition.hello_world.arn + launch_type = "FARGATE" + task_count = 1 + task_definition_arn = aws_ecs_task_definition.hello_world.arn + enable_execute_command = true + tags = { production = true } network_configuration = { assign_public_ip = true subnets = data.aws_subnet_ids.default.ids security_groups = [data.aws_security_group.default.arn] } + + capacity_provider_strategy = [{ + capacity_provider = "test" + base = 1 + weight = 100 + }] + + placement_constraint = [{ + type = "distinctInstance" + }] + + ordered_placement_strategy = [ + { + type = "spread" + field = "attribute:ecs.availability-zone" + }, + { + type = "spread" + field = "instanceId" + } + ] } } ] diff --git a/main.tf b/main.tf index 2956d1f..ddbafd3 100644 --- a/main.tf +++ b/main.tf @@ -103,11 +103,15 @@ resource "aws_cloudwatch_event_target" "this" { ] : [] content { - group = lookup(ecs_target.value, "group", null) - launch_type = lookup(ecs_target.value, "launch_type", null) - platform_version = lookup(ecs_target.value, "platform_version", null) - task_count = lookup(ecs_target.value, "task_count", null) - task_definition_arn = lookup(ecs_target.value, "task_definition_arn", null) + group = lookup(ecs_target.value, "group", null) + launch_type = lookup(ecs_target.value, "launch_type", null) + platform_version = lookup(ecs_target.value, "platform_version", null) + task_count = lookup(ecs_target.value, "task_count", null) + task_definition_arn = lookup(ecs_target.value, "task_definition_arn", null) + enable_ecs_managed_tags = lookup(ecs_target.value, "enable_ecs_managed_tags", null) + enable_execute_command = lookup(ecs_target.value, "enable_execute_command", null) + propagate_tags = lookup(ecs_target.value, "propagate_tags", null) + tags = lookup(ecs_target.value, "tags", null) dynamic "network_configuration" { for_each = lookup(ecs_target.value, "network_configuration", null) != null ? [ @@ -120,6 +124,34 @@ resource "aws_cloudwatch_event_target" "this" { assign_public_ip = lookup(network_configuration.value, "assign_public_ip", null) } } + + dynamic "capacity_provider_strategy" { + for_each = try(ecs_target.value.capacity_provider_strategy, []) + + content { + capacity_provider = try(capacity_provider_strategy.value.capacity_provider, null) + weight = try(capacity_provider_strategy.value.weight, null) + base = try(capacity_provider_strategy.value.base, null) + } + } + + dynamic "ordered_placement_strategy" { + for_each = try(ecs_target.value.ordered_placement_strategy, []) + + content { + type = try(ordered_placement_strategy.value.type, null) + field = try(ordered_placement_strategy.value.field, null) + } + } + + dynamic "placement_constraint" { + for_each = try(ecs_target.value.placement_constraint, []) + + content { + type = try(placement_constraint.value.type, null) + expression = try(placement_constraint.value.expression, null) + } + } } } diff --git a/versions.tf b/versions.tf index 36060f7..0e652f1 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.7" + version = ">= 4.64" } } } From 1f90ca5b88e9c13f96dc755695b8eb87ed15e242 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sat, 22 Apr 2023 08:55:17 -0400 Subject: [PATCH 2/7] update example --- examples/with-ecs-scheduling/main.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/with-ecs-scheduling/main.tf b/examples/with-ecs-scheduling/main.tf index 7d73de8..3e99ad9 100644 --- a/examples/with-ecs-scheduling/main.tf +++ b/examples/with-ecs-scheduling/main.tf @@ -57,11 +57,11 @@ module "eventbridge" { attach_role_arn = true ecs_target = { - launch_type = "FARGATE" - task_count = 1 - task_definition_arn = aws_ecs_task_definition.hello_world.arn - enable_execute_command = true - tags = { production = true } + launch_type = "FARGATE" + task_count = 1 + task_definition_arn = aws_ecs_task_definition.hello_world.arn + enable_ecs_managed_tags = true + tags = { production = true } network_configuration = { assign_public_ip = true From 511961262dc887057434501d008081fb56cb1f86 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sat, 22 Apr 2023 17:00:24 -0400 Subject: [PATCH 3/7] feedback changes --- examples/with-ecs-scheduling/main.tf | 23 ++++++++++++++++------- main.tf | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/examples/with-ecs-scheduling/main.tf b/examples/with-ecs-scheduling/main.tf index 3e99ad9..30544bc 100644 --- a/examples/with-ecs-scheduling/main.tf +++ b/examples/with-ecs-scheduling/main.tf @@ -57,11 +57,12 @@ module "eventbridge" { attach_role_arn = true ecs_target = { - launch_type = "FARGATE" task_count = 1 task_definition_arn = aws_ecs_task_definition.hello_world.arn enable_ecs_managed_tags = true - tags = { production = true } + tags = { + production = true + } network_configuration = { assign_public_ip = true @@ -69,11 +70,19 @@ module "eventbridge" { security_groups = [data.aws_security_group.default.arn] } - capacity_provider_strategy = [{ - capacity_provider = "test" - base = 1 - weight = 100 - }] + # If a capacity_provider_strategy is specified, the launch_type parameter must be omitted. + capacity_provider_strategy = [ + { + capacity_provider = "FARGATE" + base = 1 + weight = 100 + }, + { + capacity_provider = "FARGATE_SPOT" + base = 1 + weight = 100 + } + ] placement_constraint = [{ type = "distinctInstance" diff --git a/main.tf b/main.tf index ddbafd3..8b977cc 100644 --- a/main.tf +++ b/main.tf @@ -107,7 +107,7 @@ resource "aws_cloudwatch_event_target" "this" { launch_type = lookup(ecs_target.value, "launch_type", null) platform_version = lookup(ecs_target.value, "platform_version", null) task_count = lookup(ecs_target.value, "task_count", null) - task_definition_arn = lookup(ecs_target.value, "task_definition_arn", null) + task_definition_arn = ecs_target.value.task_definition_arn enable_ecs_managed_tags = lookup(ecs_target.value, "enable_ecs_managed_tags", null) enable_execute_command = lookup(ecs_target.value, "enable_execute_command", null) propagate_tags = lookup(ecs_target.value, "propagate_tags", null) From 3ce4bd9bddd0b1bacffdeaa146b10c2180e23b63 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sun, 23 Apr 2023 00:29:54 -0400 Subject: [PATCH 4/7] adjust example --- examples/with-ecs-scheduling/main.tf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/with-ecs-scheduling/main.tf b/examples/with-ecs-scheduling/main.tf index 30544bc..edeab05 100644 --- a/examples/with-ecs-scheduling/main.tf +++ b/examples/with-ecs-scheduling/main.tf @@ -57,6 +57,8 @@ module "eventbridge" { attach_role_arn = true ecs_target = { + # If a capacity_provider_strategy specified, the launch_type parameter must be omitted. + # launch_type = "FARGATE" task_count = 1 task_definition_arn = aws_ecs_task_definition.hello_world.arn enable_ecs_managed_tags = true @@ -71,6 +73,7 @@ module "eventbridge" { } # If a capacity_provider_strategy is specified, the launch_type parameter must be omitted. + # If no capacity_provider_strategy or launch_type is specified, the default capacity provider strategy for the cluster is used. capacity_provider_strategy = [ { capacity_provider = "FARGATE" @@ -79,7 +82,6 @@ module "eventbridge" { }, { capacity_provider = "FARGATE_SPOT" - base = 1 weight = 100 } ] From 52e118716bfb4da8438865d210197cdcab6e3a94 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sun, 23 Apr 2023 11:34:03 -0400 Subject: [PATCH 5/7] updates to example --- examples/with-ecs-scheduling/README.md | 5 +- examples/with-ecs-scheduling/main.tf | 67 ++++++++++++-------------- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/examples/with-ecs-scheduling/README.md b/examples/with-ecs-scheduling/README.md index 04378e5..4ba1611 100644 --- a/examples/with-ecs-scheduling/README.md +++ b/examples/with-ecs-scheduling/README.md @@ -34,15 +34,14 @@ 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 | +| [ecs\_cluster](#module\_ecs\_cluster) | terraform-aws-modules/ecs/aws//modules/cluster | ~> 5.0 | +| [ecs\_service](#module\_ecs\_service) | terraform-aws-modules/ecs/aws//modules/service | ~> 5.0 | | [eventbridge](#module\_eventbridge) | ../../ | n/a | ## Resources | Name | Type | |------|------| -| [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 | | [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource | | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source | | [aws_subnet_ids.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source | diff --git a/examples/with-ecs-scheduling/main.tf b/examples/with-ecs-scheduling/main.tf index edeab05..094c932 100644 --- a/examples/with-ecs-scheduling/main.tf +++ b/examples/with-ecs-scheduling/main.tf @@ -37,7 +37,7 @@ module "eventbridge" { create_role = true role_name = "ecs-eventbridge-${random_pet.this.id}" attach_ecs_policy = true - ecs_target_arns = [aws_ecs_task_definition.hello_world.arn] + ecs_target_arns = [module.ecs_service.task_definition_arn] # Fire every five minutes rules = { @@ -53,14 +53,14 @@ module "eventbridge" { orders = [ { name = "orders" - arn = module.ecs.ecs_cluster_arn + arn = module.ecs_cluster.arn attach_role_arn = true ecs_target = { # If a capacity_provider_strategy specified, the launch_type parameter must be omitted. # launch_type = "FARGATE" task_count = 1 - task_definition_arn = aws_ecs_task_definition.hello_world.arn + task_definition_arn = module.ecs_service.task_definition_arn enable_ecs_managed_tags = true tags = { production = true @@ -69,7 +69,7 @@ module "eventbridge" { network_configuration = { assign_public_ip = true subnets = data.aws_subnet_ids.default.ids - security_groups = [data.aws_security_group.default.arn] + security_groups = [data.aws_security_group.default.id] } # If a capacity_provider_strategy is specified, the launch_type parameter must be omitted. @@ -85,21 +85,6 @@ module "eventbridge" { weight = 100 } ] - - placement_constraint = [{ - type = "distinctInstance" - }] - - ordered_placement_strategy = [ - { - type = "spread" - field = "attribute:ecs.availability-zone" - }, - { - type = "spread" - field = "instanceId" - } - ] } } ] @@ -110,37 +95,45 @@ module "eventbridge" { # ECS ###### -module "ecs" { - source = "terraform-aws-modules/ecs/aws" - version = "~> 3.0" +module "ecs_cluster" { + source = "terraform-aws-modules/ecs/aws//modules/cluster" + version = "~> 5.0" - name = random_pet.this.id + cluster_name = random_pet.this.id - capacity_providers = ["FARGATE", "FARGATE_SPOT"] + fargate_capacity_providers = { + FARGATE = { + default_capacity_provider_strategy = { + weight = 100 + } + } + FARGATE_SPOT = { + default_capacity_provider_strategy = { + weight = 100 + } + } + } } -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 +module "ecs_service" { + source = "terraform-aws-modules/ecs/aws//modules/service" + version = "~> 5.0" - desired_count = 1 + name = random_pet.this.id + cluster_arn = module.ecs_cluster.arn + subnet_ids = data.aws_subnet_ids.default.ids + 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 = jsonencode([ - { - name = "hello_world-${random_pet.this.id}", + container_definitions = { + hello-world = { image = "hello-world", cpu = 0, memory = 128 } - ]) + } } ################## From 416f431fe016a3fa82224515b07270a3fb23433e Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Wed, 26 Apr 2023 19:45:24 -0400 Subject: [PATCH 6/7] update terraform version and example ecs module --- README.md | 2 +- examples/api-gateway-event-source/README.md | 2 +- examples/api-gateway-event-source/versions.tf | 2 +- examples/complete/README.md | 2 +- examples/complete/versions.tf | 2 +- examples/default-bus/README.md | 2 +- examples/default-bus/versions.tf | 2 +- examples/with-api-destination/README.md | 2 +- examples/with-api-destination/versions.tf | 2 +- examples/with-archive/README.md | 2 +- examples/with-archive/versions.tf | 2 +- examples/with-ecs-scheduling/README.md | 7 ++- examples/with-ecs-scheduling/main.tf | 47 +++++++++---------- examples/with-ecs-scheduling/versions.tf | 2 +- examples/with-lambda-scheduling/README.md | 2 +- examples/with-lambda-scheduling/versions.tf | 2 +- examples/with-permissions/README.md | 2 +- examples/with-permissions/versions.tf | 2 +- versions.tf | 2 +- 19 files changed, 43 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 647b0b3..10fc901 100644 --- a/README.md +++ b/README.md @@ -356,7 +356,7 @@ module "eventbridge" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.64 | ## Providers diff --git a/examples/api-gateway-event-source/README.md b/examples/api-gateway-event-source/README.md index 2ae2a40..92ff75d 100644 --- a/examples/api-gateway-event-source/README.md +++ b/examples/api-gateway-event-source/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.7 | | [random](#requirement\_random) | >= 3.0 | diff --git a/examples/api-gateway-event-source/versions.tf b/examples/api-gateway-event-source/versions.tf index c06fd69..4dc65f4 100644 --- a/examples/api-gateway-event-source/versions.tf +++ b/examples/api-gateway-event-source/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/complete/README.md b/examples/complete/README.md index 88629bc..dfe09b1 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.7 | | [null](#requirement\_null) | >= 2.0 | | [random](#requirement\_random) | >= 3.0 | diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index 576e5e2..de3e129 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/default-bus/README.md b/examples/default-bus/README.md index 3325cb1..4a4e110 100644 --- a/examples/default-bus/README.md +++ b/examples/default-bus/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.7 | | [random](#requirement\_random) | >= 3.0 | diff --git a/examples/default-bus/versions.tf b/examples/default-bus/versions.tf index c06fd69..4dc65f4 100644 --- a/examples/default-bus/versions.tf +++ b/examples/default-bus/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/with-api-destination/README.md b/examples/with-api-destination/README.md index dfa3e36..0fa4aca 100644 --- a/examples/with-api-destination/README.md +++ b/examples/with-api-destination/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.7 | | [random](#requirement\_random) | >= 3.0 | diff --git a/examples/with-api-destination/versions.tf b/examples/with-api-destination/versions.tf index c06fd69..4dc65f4 100644 --- a/examples/with-api-destination/versions.tf +++ b/examples/with-api-destination/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/with-archive/README.md b/examples/with-archive/README.md index c1a1935..46ce9fd 100644 --- a/examples/with-archive/README.md +++ b/examples/with-archive/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.7 | | [random](#requirement\_random) | >= 3.0 | diff --git a/examples/with-archive/versions.tf b/examples/with-archive/versions.tf index c06fd69..4dc65f4 100644 --- a/examples/with-archive/versions.tf +++ b/examples/with-archive/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/with-ecs-scheduling/README.md b/examples/with-ecs-scheduling/README.md index 4ba1611..94d7134 100644 --- a/examples/with-ecs-scheduling/README.md +++ b/examples/with-ecs-scheduling/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.7 | | [random](#requirement\_random) | >= 3.0 | @@ -34,8 +34,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Source | Version | |------|--------|---------| -| [ecs\_cluster](#module\_ecs\_cluster) | terraform-aws-modules/ecs/aws//modules/cluster | ~> 5.0 | -| [ecs\_service](#module\_ecs\_service) | terraform-aws-modules/ecs/aws//modules/service | ~> 5.0 | +| [ecs\_cluster](#module\_ecs\_cluster) | terraform-aws-modules/ecs/aws | ~> 5.0 | | [eventbridge](#module\_eventbridge) | ../../ | n/a | ## Resources @@ -44,7 +43,7 @@ Note that this example may create resources which cost money. Run `terraform des |------|------| | [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource | | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source | -| [aws_subnet_ids.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source | +| [aws_subnets.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source | | [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source | ## Inputs diff --git a/examples/with-ecs-scheduling/main.tf b/examples/with-ecs-scheduling/main.tf index 094c932..bbae3ec 100644 --- a/examples/with-ecs-scheduling/main.tf +++ b/examples/with-ecs-scheduling/main.tf @@ -21,8 +21,11 @@ data "aws_security_group" "default" { vpc_id = data.aws_vpc.default.id } -data "aws_subnet_ids" "default" { - vpc_id = data.aws_vpc.default.id +data "aws_subnets" "default" { + filter { + name = "vpc-id" + values = [data.aws_vpc.default.id] + } } #################### @@ -37,7 +40,7 @@ module "eventbridge" { create_role = true role_name = "ecs-eventbridge-${random_pet.this.id}" attach_ecs_policy = true - ecs_target_arns = [module.ecs_service.task_definition_arn] + ecs_target_arns = [module.ecs_cluster.services["hello-world"].task_definition_arn] # Fire every five minutes rules = { @@ -53,14 +56,14 @@ module "eventbridge" { orders = [ { name = "orders" - arn = module.ecs_cluster.arn + arn = module.ecs_cluster.cluster_arn attach_role_arn = true ecs_target = { # If a capacity_provider_strategy specified, the launch_type parameter must be omitted. # launch_type = "FARGATE" task_count = 1 - task_definition_arn = module.ecs_service.task_definition_arn + task_definition_arn = module.ecs_cluster.services["hello-world"].task_definition_arn enable_ecs_managed_tags = true tags = { production = true @@ -68,7 +71,7 @@ module "eventbridge" { network_configuration = { assign_public_ip = true - subnets = data.aws_subnet_ids.default.ids + subnets = data.aws_subnets.default.ids security_groups = [data.aws_security_group.default.id] } @@ -96,7 +99,7 @@ module "eventbridge" { ###### module "ecs_cluster" { - source = "terraform-aws-modules/ecs/aws//modules/cluster" + source = "terraform-aws-modules/ecs/aws" version = "~> 5.0" cluster_name = random_pet.this.id @@ -113,25 +116,21 @@ module "ecs_cluster" { } } } -} - -module "ecs_service" { - source = "terraform-aws-modules/ecs/aws//modules/service" - version = "~> 5.0" - name = random_pet.this.id - cluster_arn = module.ecs_cluster.arn - - subnet_ids = data.aws_subnet_ids.default.ids - desired_count = 1 - deployment_maximum_percent = 100 - deployment_minimum_healthy_percent = 0 - - container_definitions = { + services = { hello-world = { - image = "hello-world", - cpu = 0, - memory = 128 + subnet_ids = data.aws_subnets.default.ids + desired_count = 1 + deployment_maximum_percent = 100 + deployment_minimum_healthy_percent = 0 + + container_definitions = { + hello-world = { + image = "hello-world", + cpu = 0, + memory = 128 + } + } } } } diff --git a/examples/with-ecs-scheduling/versions.tf b/examples/with-ecs-scheduling/versions.tf index c06fd69..4dc65f4 100644 --- a/examples/with-ecs-scheduling/versions.tf +++ b/examples/with-ecs-scheduling/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/with-lambda-scheduling/README.md b/examples/with-lambda-scheduling/README.md index de5b024..0afde98 100644 --- a/examples/with-lambda-scheduling/README.md +++ b/examples/with-lambda-scheduling/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.7 | | [null](#requirement\_null) | >= 2.0 | | [random](#requirement\_random) | >= 3.0 | diff --git a/examples/with-lambda-scheduling/versions.tf b/examples/with-lambda-scheduling/versions.tf index 576e5e2..de3e129 100644 --- a/examples/with-lambda-scheduling/versions.tf +++ b/examples/with-lambda-scheduling/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/with-permissions/README.md b/examples/with-permissions/README.md index 7be537b..d61e7cf 100644 --- a/examples/with-permissions/README.md +++ b/examples/with-permissions/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.7 | | [random](#requirement\_random) | >= 3.0 | diff --git a/examples/with-permissions/versions.tf b/examples/with-permissions/versions.tf index c06fd69..4dc65f4 100644 --- a/examples/with-permissions/versions.tf +++ b/examples/with-permissions/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/versions.tf b/versions.tf index 0e652f1..726b2bb 100644 --- a/versions.tf +++ b/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { From 37b78b6486c6398cab0dd7ca9d4f23bd87d501ab Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Wed, 26 Apr 2023 19:52:45 -0400 Subject: [PATCH 7/7] bump all aws provider versions in examples as well --- examples/api-gateway-event-source/README.md | 4 ++-- examples/api-gateway-event-source/versions.tf | 2 +- examples/complete/README.md | 4 ++-- examples/complete/versions.tf | 2 +- examples/default-bus/README.md | 4 ++-- examples/default-bus/versions.tf | 2 +- examples/with-api-destination/README.md | 4 ++-- examples/with-api-destination/versions.tf | 2 +- examples/with-archive/README.md | 4 ++-- examples/with-archive/versions.tf | 2 +- examples/with-ecs-scheduling/README.md | 4 ++-- examples/with-ecs-scheduling/versions.tf | 2 +- examples/with-lambda-scheduling/README.md | 2 +- examples/with-lambda-scheduling/versions.tf | 2 +- examples/with-permissions/README.md | 4 ++-- examples/with-permissions/versions.tf | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/api-gateway-event-source/README.md b/examples/api-gateway-event-source/README.md index 92ff75d..2672a52 100644 --- a/examples/api-gateway-event-source/README.md +++ b/examples/api-gateway-event-source/README.md @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.7 | +| [aws](#requirement\_aws) | >= 4.64 | | [random](#requirement\_random) | >= 3.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.7 | +| [aws](#provider\_aws) | >= 4.64 | | [random](#provider\_random) | >= 3.0 | ## Modules diff --git a/examples/api-gateway-event-source/versions.tf b/examples/api-gateway-event-source/versions.tf index 4dc65f4..9bc2614 100644 --- a/examples/api-gateway-event-source/versions.tf +++ b/examples/api-gateway-event-source/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.7" + version = ">= 4.64" } random = { source = "hashicorp/random" diff --git a/examples/complete/README.md b/examples/complete/README.md index dfe09b1..9c9e34b 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -20,7 +20,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.7 | +| [aws](#requirement\_aws) | >= 4.64 | | [null](#requirement\_null) | >= 2.0 | | [random](#requirement\_random) | >= 3.0 | @@ -28,7 +28,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.7 | +| [aws](#provider\_aws) | >= 4.64 | | [null](#provider\_null) | >= 2.0 | | [random](#provider\_random) | >= 3.0 | diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index de3e129..cdf3d85 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.7" + version = ">= 4.64" } random = { source = "hashicorp/random" diff --git a/examples/default-bus/README.md b/examples/default-bus/README.md index 4a4e110..84046d2 100644 --- a/examples/default-bus/README.md +++ b/examples/default-bus/README.md @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.7 | +| [aws](#requirement\_aws) | >= 4.64 | | [random](#requirement\_random) | >= 3.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.7 | +| [aws](#provider\_aws) | >= 4.64 | | [random](#provider\_random) | >= 3.0 | ## Modules diff --git a/examples/default-bus/versions.tf b/examples/default-bus/versions.tf index 4dc65f4..9bc2614 100644 --- a/examples/default-bus/versions.tf +++ b/examples/default-bus/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.7" + version = ">= 4.64" } random = { source = "hashicorp/random" diff --git a/examples/with-api-destination/README.md b/examples/with-api-destination/README.md index 0fa4aca..ad5289b 100644 --- a/examples/with-api-destination/README.md +++ b/examples/with-api-destination/README.md @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.7 | +| [aws](#requirement\_aws) | >= 4.64 | | [random](#requirement\_random) | >= 3.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.7 | +| [aws](#provider\_aws) | >= 4.64 | | [random](#provider\_random) | >= 3.0 | ## Modules diff --git a/examples/with-api-destination/versions.tf b/examples/with-api-destination/versions.tf index 4dc65f4..9bc2614 100644 --- a/examples/with-api-destination/versions.tf +++ b/examples/with-api-destination/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.7" + version = ">= 4.64" } random = { source = "hashicorp/random" diff --git a/examples/with-archive/README.md b/examples/with-archive/README.md index 46ce9fd..a866416 100644 --- a/examples/with-archive/README.md +++ b/examples/with-archive/README.md @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.7 | +| [aws](#requirement\_aws) | >= 4.64 | | [random](#requirement\_random) | >= 3.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.7 | +| [aws](#provider\_aws) | >= 4.64 | | [random](#provider\_random) | >= 3.0 | ## Modules diff --git a/examples/with-archive/versions.tf b/examples/with-archive/versions.tf index 4dc65f4..9bc2614 100644 --- a/examples/with-archive/versions.tf +++ b/examples/with-archive/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.7" + version = ">= 4.64" } random = { source = "hashicorp/random" diff --git a/examples/with-ecs-scheduling/README.md b/examples/with-ecs-scheduling/README.md index 94d7134..45366bb 100644 --- a/examples/with-ecs-scheduling/README.md +++ b/examples/with-ecs-scheduling/README.md @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.7 | +| [aws](#requirement\_aws) | >= 4.64 | | [random](#requirement\_random) | >= 3.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.7 | +| [aws](#provider\_aws) | >= 4.64 | | [random](#provider\_random) | >= 3.0 | ## Modules diff --git a/examples/with-ecs-scheduling/versions.tf b/examples/with-ecs-scheduling/versions.tf index 4dc65f4..9bc2614 100644 --- a/examples/with-ecs-scheduling/versions.tf +++ b/examples/with-ecs-scheduling/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.7" + version = ">= 4.64" } random = { source = "hashicorp/random" diff --git a/examples/with-lambda-scheduling/README.md b/examples/with-lambda-scheduling/README.md index 0afde98..91817df 100644 --- a/examples/with-lambda-scheduling/README.md +++ b/examples/with-lambda-scheduling/README.md @@ -20,7 +20,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.7 | +| [aws](#requirement\_aws) | >= 4.64 | | [null](#requirement\_null) | >= 2.0 | | [random](#requirement\_random) | >= 3.0 | diff --git a/examples/with-lambda-scheduling/versions.tf b/examples/with-lambda-scheduling/versions.tf index de3e129..cdf3d85 100644 --- a/examples/with-lambda-scheduling/versions.tf +++ b/examples/with-lambda-scheduling/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.7" + version = ">= 4.64" } random = { source = "hashicorp/random" diff --git a/examples/with-permissions/README.md b/examples/with-permissions/README.md index d61e7cf..81a5cb5 100644 --- a/examples/with-permissions/README.md +++ b/examples/with-permissions/README.md @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.7 | +| [aws](#requirement\_aws) | >= 4.64 | | [random](#requirement\_random) | >= 3.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.7 | +| [aws](#provider\_aws) | >= 4.64 | | [random](#provider\_random) | >= 3.0 | ## Modules diff --git a/examples/with-permissions/versions.tf b/examples/with-permissions/versions.tf index 4dc65f4..9bc2614 100644 --- a/examples/with-permissions/versions.tf +++ b/examples/with-permissions/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.7" + version = ">= 4.64" } random = { source = "hashicorp/random"