Skip to content

Commit

Permalink
refactor: Initial pass at variable type definitions for service module'
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs committed Nov 23, 2024
1 parent 8e053ee commit 9ef8b25
Show file tree
Hide file tree
Showing 27 changed files with 758 additions and 458 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: Terraform min/max versions
id: minMax
uses: clowdhaus/[email protected]
uses: clowdhaus/[email protected].10.1
with:
directory: ${{ matrix.directory }}

Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:

- name: Terraform min/max versions
id: minMax
uses: clowdhaus/[email protected]
uses: clowdhaus/[email protected].10.1

- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
uses: clowdhaus/terraform-composite-actions/[email protected]
Expand Down
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

All notable changes to this project will be documented in this file.

## [5.11.4](https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v5.11.3...v5.11.4) (2024-08-07)
## [5.11.4](https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v5.11.3.10...v5.11.4) (2024-08-07)


### Bug Fixes

* Local `cluster_name` error when `var.cluster_arn` is empty ([#218](https://github.com/terraform-aws-modules/terraform-aws-ecs/issues/218)) ([42f11fe](https://github.com/terraform-aws-modules/terraform-aws-ecs/commit/42f11fe46b1f2a00125af0ee98813bff25d0bc46))

## [5.11.3](https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v5.11.2...v5.11.3) (2024-07-05)
## [5.11.3.10](https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v5.11.2...v5.11.3.10) (2024-07-05)


### Bug Fixes
Expand Down Expand Up @@ -198,7 +198,7 @@ All notable changes to this project will be documented in this file.

* Ensure that launch type is not specified when a capacity provider strategy is set on a service ([#80](https://github.com/terraform-aws-modules/terraform-aws-ecs/issues/80)) ([873cccf](https://github.com/terraform-aws-modules/terraform-aws-ecs/commit/873cccf1ea23b87fec8bffe0a4825178f0b1cacf))

## [5.0.0](https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v4.1.3...v5.0.0) (2023-04-21)
## [5.0.0](https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v4.1.3.10...v5.0.0) (2023-04-21)


### ⚠ BREAKING CHANGES
Expand All @@ -209,7 +209,7 @@ All notable changes to this project will be documented in this file.

* Add support for creating ECS service and container definition ([#76](https://github.com/terraform-aws-modules/terraform-aws-ecs/issues/76)) ([57244e6](https://github.com/terraform-aws-modules/terraform-aws-ecs/commit/57244e69abea685f7d45352abc994779b5f6d352))

### [4.1.3](https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v4.1.2...v4.1.3) (2023-01-24)
### [4.1.3.10](https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v4.1.2...v4.1.3.10) (2023-01-24)


### Bug Fixes
Expand Down Expand Up @@ -380,8 +380,8 @@ All notable changes to this project will be documented in this file.
- Added changelog


<a name="v1.3.0"></a>
## [v1.3.0] - 2019-03-08
<a name="v1.3.10.0"></a>
## [v1.3.10.0] - 2019-03-08

- Add tag support for ECS module

Expand Down Expand Up @@ -446,8 +446,8 @@ All notable changes to this project will be documented in this file.
[v2.2.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v2.1.0...v2.2.0
[v2.1.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v2.0.0...v2.1.0
[v2.0.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v1.4.0...v2.0.0
[v1.4.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v1.3.0...v1.4.0
[v1.3.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v1.2.0...v1.3.0
[v1.4.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v1.3.10.0...v1.4.0
[v1.3.10.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v1.2.0...v1.3.10.0
[v1.2.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v1.1.0...v1.2.0
[v1.1.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v1.0.0...v1.1.0
[v1.0.0]: https://github.com/terraform-aws-modules/terraform-aws-ecs/compare/v0.0.1...v1.0.0
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ module "ecs" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.63 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.10 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.77 |

## Providers

Expand Down
6 changes: 3 additions & 3 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Note that this example may create resources which will incur monetary charges on

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.63 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.10 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.77 |

## Providers

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

## Modules

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 = ">= 1.3"
required_version = ">= 1.3.10"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.63"
version = ">= 5.77"
}
}
}
6 changes: 3 additions & 3 deletions examples/ec2-autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Note that this example may create resources which will incur monetary charges on

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.63 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.10 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.77 |

## Providers

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

## Modules

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

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.63"
version = ">= 5.77"
}
}
}
7 changes: 3 additions & 4 deletions examples/fargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Note that this example may create resources which will incur monetary charges on

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.63 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.10 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.77 |

## Providers

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

## Modules

Expand Down Expand Up @@ -78,7 +78,6 @@ No inputs.
| <a name="output_service_security_group_id"></a> [service\_security\_group\_id](#output\_service\_security\_group\_id) | ID of the security group |
| <a name="output_service_task_definition_arn"></a> [service\_task\_definition\_arn](#output\_service\_task\_definition\_arn) | Full ARN of the Task Definition (including both `family` and `revision`) |
| <a name="output_service_task_definition_family"></a> [service\_task\_definition\_family](#output\_service\_task\_definition\_family) | The unique name of the task definition |
| <a name="output_service_task_definition_family_revision"></a> [service\_task\_definition\_family\_revision](#output\_service\_task\_definition\_family\_revision) | The family and revision (family:revision) of the task definition |
| <a name="output_service_task_definition_revision"></a> [service\_task\_definition\_revision](#output\_service\_task\_definition\_revision) | Revision of the task in a particular family |
| <a name="output_service_task_exec_iam_role_arn"></a> [service\_task\_exec\_iam\_role\_arn](#output\_service\_task\_exec\_iam\_role\_arn) | Task execution IAM role ARN |
| <a name="output_service_task_exec_iam_role_name"></a> [service\_task\_exec\_iam\_role\_name](#output\_service\_task\_exec\_iam\_role\_name) | Task execution IAM role name |
Expand Down
24 changes: 10 additions & 14 deletions examples/fargate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,19 @@ module "ecs_service" {
}

subnet_ids = module.vpc.private_subnets
security_group_rules = {
security_group_ingress_rules = {
alb_ingress_3000 = {
type = "ingress"
from_port = local.container_port
to_port = local.container_port
protocol = "tcp"
description = "Service port"
from_port = local.container_port
ip_protocol = "tcp"
source_security_group_id = module.alb.security_group_id
}
}
security_group_egress_rules = {
egress_all = {
type = "egress"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ip_protocol = "-1"
cidr_ipv4 = "0.0.0.0/0"
}
}

Expand Down Expand Up @@ -225,13 +223,11 @@ module "ecs_task_definition" {

subnet_ids = module.vpc.private_subnets

security_group_rules = {
security_group_egress_rules = {
egress_all = {
type = "egress"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ip_protocol = "-1"
cidr_ipv4 = "0.0.0.0/0"
}
}

Expand Down
7 changes: 1 addition & 6 deletions examples/fargate/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ output "service_task_definition_family" {
value = module.ecs_service.task_definition_family
}

output "service_task_definition_family_revision" {
description = "The family and revision (family:revision) of the task definition"
value = module.ecs_service.task_definition_family_revision
}

output "service_task_exec_iam_role_name" {
description = "Task execution IAM role name"
value = module.ecs_service.task_exec_iam_role_name
Expand Down Expand Up @@ -159,7 +154,7 @@ output "task_definition_run_task_command" {
description = "awscli command to run the standalone task"
value = <<EOT
aws ecs run-task --cluster ${module.ecs_cluster.name} \
--task-definition ${module.ecs_task_definition.task_definition_family_revision} \
--task-definition ${module.ecs_task_definition.task_definition_family}:${module.ecs_task_definition.task_definition_revision} \
--network-configuration "awsvpcConfiguration={subnets=[${join(",", module.vpc.private_subnets)}],securityGroups=[${module.ecs_task_definition.security_group_id}]}" \
--region ${local.region}
EOT
Expand Down
4 changes: 2 additions & 2 deletions examples/fargate/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.3"
required_version = ">= 1.3.10"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.63"
version = ">= 5.77"
}
}
}
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ module "service" {
security_group_name = try(each.value.security_group_name, null)
security_group_use_name_prefix = try(each.value.security_group_use_name_prefix, true)
security_group_description = try(each.value.security_group_description, null)
security_group_rules = lookup(each.value, "security_group_rules", {})
security_group_ingress_rules = lookup(each.value, "security_group_ingress_rules", {})
security_group_egress_rules = lookup(each.value, "security_group_egress_rules", {})
security_group_tags = try(each.value.security_group_tags, {})

tags = merge(var.tags, try(each.value.tags, {}))
Expand Down
6 changes: 3 additions & 3 deletions modules/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ module "ecs_cluster" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.63 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.10 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.77 |

## Providers

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

## Modules

Expand Down
4 changes: 2 additions & 2 deletions modules/cluster/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.3"
required_version = ">= 1.3.10"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.63"
version = ">= 5.77"
}
}
}
6 changes: 3 additions & 3 deletions modules/container-definition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ module "example_ecs_container_definition" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.63 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.10 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.77 |

## Providers

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

## Modules

Expand Down
4 changes: 2 additions & 2 deletions modules/container-definition/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.3"
required_version = ">= 1.3.10"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.63"
version = ">= 5.77"
}
}
}
Loading

0 comments on commit 9ef8b25

Please sign in to comment.