Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Bump Terraform version to 1.0 and updated ecs_target arguments #85

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,14 @@ module "eventbridge" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.7 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.7 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |

## Modules

Expand Down
6 changes: 3 additions & 3 deletions examples/api-gateway-event-source/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.7 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.7 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |

## Modules
Expand Down
4 changes: 2 additions & 2 deletions examples/api-gateway-event-source/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.7"
version = ">= 4.64"
}
random = {
source = "hashicorp/random"
Expand Down
6 changes: 3 additions & 3 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.7 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.7 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |

Expand Down
4 changes: 2 additions & 2 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.7"
version = ">= 4.64"
}
random = {
source = "hashicorp/random"
Expand Down
6 changes: 3 additions & 3 deletions examples/default-bus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.7 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.7 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |

## Modules
Expand Down
4 changes: 2 additions & 2 deletions examples/default-bus/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.7"
version = ">= 4.64"
}
random = {
source = "hashicorp/random"
Expand Down
6 changes: 3 additions & 3 deletions examples/with-api-destination/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.7 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.7 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |

## Modules
Expand Down
4 changes: 2 additions & 2 deletions examples/with-api-destination/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.7"
version = ">= 4.64"
}
random = {
source = "hashicorp/random"
Expand Down
6 changes: 3 additions & 3 deletions examples/with-archive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.7 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.7 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |

## Modules
Expand Down
4 changes: 2 additions & 2 deletions examples/with-archive/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.7"
version = ">= 4.64"
}
random = {
source = "hashicorp/random"
Expand Down
12 changes: 5 additions & 7 deletions examples/with-ecs-scheduling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,31 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.7 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.7 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.64 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_ecs"></a> [ecs](#module\_ecs) | terraform-aws-modules/ecs/aws | ~> 3.0 |
| <a name="module_ecs_cluster"></a> [ecs\_cluster](#module\_ecs\_cluster) | terraform-aws-modules/ecs/aws | ~> 5.0 |
| <a name="module_eventbridge"></a> [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 |
| [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
Expand Down
96 changes: 61 additions & 35 deletions examples/with-ecs-scheduling/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}

####################
Expand All @@ -37,7 +40,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_cluster.services["hello-world"].task_definition_arn]

# Fire every five minutes
rules = {
Expand All @@ -53,19 +56,38 @@ module "eventbridge" {
orders = [
{
name = "orders"
arn = module.ecs.ecs_cluster_arn
arn = module.ecs_cluster.cluster_arn
attach_role_arn = true

ecs_target = {
launch_type = "FARGATE"
task_count = 1
task_definition_arn = aws_ecs_task_definition.hello_world.arn
# If a capacity_provider_strategy specified, the launch_type parameter must be omitted.
# launch_type = "FARGATE"
task_count = 1
task_definition_arn = module.ecs_cluster.services["hello-world"].task_definition_arn
enable_ecs_managed_tags = 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]
subnets = data.aws_subnets.default.ids
security_groups = [data.aws_security_group.default.id]
}

# 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"
base = 1
weight = 100
},
{
capacity_provider = "FARGATE_SPOT"
weight = 100
}
]
}
}
]
Expand All @@ -76,37 +98,41 @@ module "eventbridge" {
# ECS
######

module "ecs" {
module "ecs_cluster" {
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

desired_count = 1
version = "~> 5.0"

deployment_maximum_percent = 100
deployment_minimum_healthy_percent = 0
}
cluster_name = random_pet.this.id

resource "aws_ecs_task_definition" "hello_world" {
family = "hello_world-${random_pet.this.id}"
fargate_capacity_providers = {
FARGATE = {
default_capacity_provider_strategy = {
weight = 100
}
}
FARGATE_SPOT = {
default_capacity_provider_strategy = {
weight = 100
}
}
}

container_definitions = jsonencode([
{
name = "hello_world-${random_pet.this.id}",
image = "hello-world",
cpu = 0,
memory = 128
services = {
hello-world = {
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
}
}
}
])
}
}

##################
Expand Down
4 changes: 2 additions & 2 deletions examples/with-ecs-scheduling/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.7"
version = ">= 4.64"
}
random = {
source = "hashicorp/random"
Expand Down
4 changes: 2 additions & 2 deletions examples/with-lambda-scheduling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.7 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.64 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |

Expand Down
4 changes: 2 additions & 2 deletions examples/with-lambda-scheduling/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.7"
version = ">= 4.64"
}
random = {
source = "hashicorp/random"
Expand Down
Loading