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 62f347d
Show file tree
Hide file tree
Showing 25 changed files with 748 additions and 448 deletions.
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 62f347d

Please sign in to comment.