Skip to content

Commit 4c45791

Browse files
authored
Add ability to add custom tags to cluster and service (#26)
1 parent f111628 commit 4c45791

File tree

8 files changed

+24
-8
lines changed

8 files changed

+24
-8
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ No resources.
5050
| <a name="input_asg_volume_size"></a> [asg\_volume\_size](#input\_asg\_volume\_size) | Specify the volume size for the root ebs | `string` | `30` | no |
5151
| <a name="input_asg_wait_for_capacity_timeout"></a> [asg\_wait\_for\_capacity\_timeout](#input\_asg\_wait\_for\_capacity\_timeout) | A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. (See also Waiting for Capacity below.) Setting this to '0' causes Terraform to skip all Capacity Waiting behavior. | `string` | `null` | no |
5252
| <a name="input_assign_public_ip"></a> [assign\_public\_ip](#input\_assign\_public\_ip) | Enable a public IP address for the container | `bool` | `false` | no |
53+
| <a name="input_capacity_providers"></a> [capacity\_providers](#input\_capacity\_providers) | List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE\_SPOT. | `list(string)` | `[]` | no |
54+
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | tags to be added to ECS cluster | `map(any)` | `{}` | no |
5355
| <a name="input_create_launch_template"></a> [create\_launch\_template](#input\_create\_launch\_template) | Create a launch template | `bool` | `true` | no |
56+
| <a name="input_default_capacity_provider_strategy"></a> [default\_capacity\_provider\_strategy](#input\_default\_capacity\_provider\_strategy) | The capacity provider strategy to use by default for the cluster. Can be one or more. | `list(map(any))` | `[]` | no |
5457
| <a name="input_enable_execute_command"></a> [enable\_execute\_command](#input\_enable\_execute\_command) | Specifies whether to enable Amazon ECS Exec for the tasks within the service | `bool` | `false` | no |
5558
| <a name="input_launch_type"></a> [launch\_type](#input\_launch\_type) | The launch type on which to run your task.(EC2\|FARGATE) | `string` | `"EC2"` | no |
5659
| <a name="input_link_ecs_to_asg_capacity_provider"></a> [link\_ecs\_to\_asg\_capacity\_provider](#input\_link\_ecs\_to\_asg\_capacity\_provider) | Specify whether to link ECS to autoscaling group capacity provider | `bool` | `false` | no |
@@ -65,11 +68,10 @@ No resources.
6568
| <a name="input_service_scale_out_cooldown"></a> [service\_scale\_out\_cooldown](#input\_service\_scale\_out\_cooldown) | Time between scale out action | `number` | `300` | no |
6669
| <a name="input_service_security_groups"></a> [service\_security\_groups](#input\_service\_security\_groups) | Security group IDs to attach to your ECS Service | `list(string)` | `[]` | no |
6770
| <a name="input_service_subnets"></a> [service\_subnets](#input\_service\_subnets) | Private subnets for ECS | `list(string)` | `[]` | no |
71+
| <a name="input_service_tags"></a> [service\_tags](#input\_service\_tags) | tags to be added to task definitions | `map(any)` | `{}` | no |
6872
| <a name="input_service_target_cpu_value"></a> [service\_target\_cpu\_value](#input\_service\_target\_cpu\_value) | Autoscale when CPU Usage value over the specified value. Must be specified if `enable_cpu_based_autoscaling` is `true`. | `number` | `70` | no |
6973
| <a name="input_service_task_execution_role_arn"></a> [service\_task\_execution\_role\_arn](#input\_service\_task\_execution\_role\_arn) | Default IAM role for ECS execution | `string` | `""` | no |
7074
| <a name="input_service_task_role_arn"></a> [service\_task\_role\_arn](#input\_service\_task\_role\_arn) | Default IAM role for ECS task | `string` | `""` | no |
71-
| <a name="capacity_providers"></a> [capacity\_provider](#default\_capacity\_provider\_strategy) | Capacity providers for ECS Cluster | `list(string)` | `[]` | no |
72-
| <a name="default_capacity_provider_strategy"></a> [default\_capacity\_provider\_strategy](#default\_capacity\_provider\_strategy) | Default capacity provider strategy for ECS Cluster | `list(map(any))` | `[]` | no |
7375
| <a name="input_task_placement_constraints"></a> [task\_placement\_constraints](#input\_task\_placement\_constraints) | The rules that are taken into consideration during task placement. Maximum number of placement\_constraints is 10 | <pre>list(object({<br> type = string<br> expression = string<br> }))</pre> | `[]` | no |
7476

7577
## Outputs

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module "cluster" {
4242

4343
default_capacity_provider_strategy = var.default_capacity_provider_strategy
4444
capacity_providers = var.capacity_providers
45+
tags = var.cluster_tags
4546
}
4647

4748
module "service" {
@@ -77,7 +78,7 @@ module "service" {
7778
task_placement_constraints = var.task_placement_constraints
7879

7980
capacity_provider_strategy = var.default_capacity_provider_strategy
80-
81+
tags = var.service_tags
8182
}
8283

8384
module "service_cpu_autoscaling_policy" {

modules/autoscaling-policy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
| Name | Version |
1212
|------|---------|
13-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.31.0 |
13+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.38.0 |
1414

1515
## Modules
1616

modules/cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
| Name | Version |
1212
|------|---------|
13-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.31.0 |
13+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.38.0 |
1414

1515
## Modules
1616

modules/iam/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
| Name | Version |
1111
|------|---------|
12-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.31.0 |
12+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.38.0 |
1313

1414
## Modules
1515

modules/service-discovery/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
| Name | Version |
1212
|------|---------|
13-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.31.0 |
13+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.38.0 |
1414

1515
## Modules
1616

modules/service/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
| Name | Version |
1212
|------|---------|
13-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.31.0 |
13+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.38.0 |
1414

1515
## Modules
1616

@@ -29,6 +29,7 @@ No modules.
2929
| Name | Description | Type | Default | Required |
3030
|------|-------------|------|---------|:--------:|
3131
| <a name="input_assign_public_ip"></a> [assign\_public\_ip](#input\_assign\_public\_ip) | Flag for enabling/disabling public IP for ECS Containers | `bool` | `false` | no |
32+
| <a name="input_capacity_provider_strategy"></a> [capacity\_provider\_strategy](#input\_capacity\_provider\_strategy) | The capacity provider strategy to use by ecs service. Can be one or more. | `list(map(any))` | `[]` | no |
3233
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | Cluster ID | `string` | n/a | yes |
3334
| <a name="input_container_definitions"></a> [container\_definitions](#input\_container\_definitions) | A list of container definitions in JSON format that describe the different containers that make up your task | `string` | n/a | yes |
3435
| <a name="input_deployment_circuit_breaker"></a> [deployment\_circuit\_breaker](#input\_deployment\_circuit\_breaker) | Configuration block for deployment circuit breaker | `any` | `{}` | no |

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ variable "link_ecs_to_asg_capacity_provider" {
1313
default = false
1414
}
1515

16+
variable "cluster_tags" {
17+
type = map(any)
18+
default = {}
19+
description = "tags to be added to ECS cluster"
20+
}
21+
1622
##############################
1723
# ECS - service
1824
##############################
@@ -83,6 +89,12 @@ variable "enable_execute_command" {
8389
default = false
8490
}
8591

92+
variable "service_tags" {
93+
type = map(any)
94+
default = {}
95+
description = "tags to be added to task definitions"
96+
}
97+
8698
################################################################################
8799
# Autoscaling group
88100
################################################################################

0 commit comments

Comments
 (0)