Skip to content

Commit 8e33c14

Browse files
committed
Add more missing tags
1 parent 6d2ebd3 commit 8e33c14

File tree

3 files changed

+32
-18
lines changed

3 files changed

+32
-18
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ preconfigured solution for seamless scalability and high availability."
5353
|------|-------------|------|---------|:--------:|
5454
| <a name="input_assign_public_ip"></a> [assign\_public\_ip](#input\_assign\_public\_ip) | Assign a public IP address to the ENI. | `bool` | `false` | no |
5555
| <a name="input_cloudwatch_log_group_name"></a> [cloudwatch\_log\_group\_name](#input\_cloudwatch\_log\_group\_name) | The name of the CloudWatch log group. | `string` | `null` | no |
56+
| <a name="input_cloudwatch_log_group_retention_in_days"></a> [cloudwatch\_log\_group\_retention\_in\_days](#input\_cloudwatch\_log\_group\_retention\_in\_days) | The number of days log events are kept in CloudWatch log group. | `number` | `30` | no |
5657
| <a name="input_codedeploy_auto_rollback_events"></a> [codedeploy\_auto\_rollback\_events](#input\_codedeploy\_auto\_rollback\_events) | The event type or types that trigger a rollback. If none are defined `auto_rollback` will be disabled. | `list(string)` | <pre>[<br> "DEPLOYMENT_FAILURE",<br> "DEPLOYMENT_STOP_ON_ALARM"<br>]</pre> | no |
5758
| <a name="input_codedeploy_cloudwatch_alarm_names"></a> [codedeploy\_cloudwatch\_alarm\_names](#input\_codedeploy\_cloudwatch\_alarm\_names) | Cloudwatch alarm NAMES (not ARNs) to add to the deployment group. Allows automated rollback on errors. | `list(string)` | `[]` | no |
5859
| <a name="input_codedeploy_deployment_config_name"></a> [codedeploy\_deployment\_config\_name](#input\_codedeploy\_deployment\_config\_name) | The name of the group's deployment config. | `string` | `"CodeDeployDefault.ECSAllAtOnce"` | no |
@@ -145,14 +146,14 @@ preconfigured solution for seamless scalability and high availability."
145146

146147
## Resources
147148

148-
- resource.aws_cloudwatch_log_group.main (main.tf#306)
149-
- resource.aws_codedeploy_app.main (main.tf#228)
150-
- resource.aws_codedeploy_deployment_group.main (main.tf#235)
151-
- resource.aws_ecs_service.main (main.tf#55)
152-
- resource.aws_lb_listener.main (main.tf#175)
153-
- resource.aws_lb_listener.test_listener (main.tf#201)
154-
- resource.aws_lb_target_group.main (main.tf#132)
155-
- resource.random_id.target_group (main.tf#121)
149+
- resource.aws_cloudwatch_log_group.main (main.tf#309)
150+
- resource.aws_codedeploy_app.main (main.tf#231)
151+
- resource.aws_codedeploy_deployment_group.main (main.tf#238)
152+
- resource.aws_ecs_service.main (main.tf#56)
153+
- resource.aws_lb_listener.main (main.tf#176)
154+
- resource.aws_lb_listener.test_listener (main.tf#202)
155+
- resource.aws_lb_target_group.main (main.tf#133)
156+
- resource.random_id.target_group (main.tf#122)
156157
- data source.aws_subnet.main (data.tf#1)
157158

158159
# Examples

main.tf

+17-9
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ module "task_definition" {
4646
proxy_configuration = var.task_proxy_configuration
4747
additional_execute_role_policies = var.task_additional_execute_role_policies
4848
additional_task_role_policies = var.task_additional_task_role_policies
49-
tags = var.tags
49+
50+
tags = var.tags
5051
}
5152

5253
#
@@ -100,18 +101,18 @@ resource "aws_ecs_service" "main" {
100101
}
101102
}
102103

103-
# Tags
104-
enable_ecs_managed_tags = var.enable_ecs_managed_tags
105-
propagate_tags = var.propagate_tags
106-
tags = var.tags
107-
108104
lifecycle {
109105
# These values will be updated by CodeDeploy after the initial setup and
110106
# can not be touched directly by TF again
111107
ignore_changes = [task_definition, network_configuration, load_balancer, desired_count]
112108
}
113109

114110
depends_on = [module.task_definition, aws_lb_target_group.main]
111+
112+
# Tags
113+
enable_ecs_managed_tags = var.enable_ecs_managed_tags
114+
propagate_tags = var.propagate_tags
115+
tags = var.tags
115116
}
116117

117118
#
@@ -193,9 +194,9 @@ resource "aws_lb_listener" "main" {
193194
ignore_changes = [default_action]
194195
}
195196

196-
tags = var.tags
197-
198197
depends_on = [aws_lb_target_group.main]
198+
199+
tags = var.tags
199200
}
200201

201202
resource "aws_lb_listener" "test_listener" {
@@ -220,6 +221,8 @@ resource "aws_lb_listener" "test_listener" {
220221
}
221222

222223
depends_on = [aws_lb_target_group.main]
224+
225+
tags = var.tags
223226
}
224227

225228
#
@@ -306,7 +309,10 @@ resource "aws_codedeploy_deployment_group" "main" {
306309
resource "aws_cloudwatch_log_group" "main" {
307310
count = var.create_cloudwatch_log_group ? 1 : 0
308311

309-
name = coalesce(var.cloudwatch_log_group_name, "/aws/ecs/${var.ecs_cluster_name}/${var.name}")
312+
name = coalesce(var.cloudwatch_log_group_name, "/aws/ecs/${var.ecs_cluster_name}/${var.name}")
313+
retention_in_days = var.cloudwatch_log_group_retention_in_days
314+
315+
tags = var.tags
310316
}
311317

312318
#
@@ -321,4 +327,6 @@ module "iam_role_codedeploy" {
321327

322328
assume_roles = { "Service" : { identifiers = ["codedeploy.amazonaws.com"] } }
323329
policy_arns = ["arn:aws:iam::aws:policy/AWSCodeDeployRoleForECS"]
330+
331+
tags = var.tags
324332
}

variables.tf

+6-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ variable "codedeploy_cloudwatch_alarm_names" {
285285
type = list(string)
286286
}
287287

288-
289288
# TARGET GROUP
290289
variable "target_group_load_balancing_algorithm_type" {
291290
description = "Determines how the load balancer selects targets when routing requests."
@@ -508,3 +507,9 @@ variable "cloudwatch_log_group_name" {
508507
default = null
509508
type = string
510509
}
510+
511+
variable "cloudwatch_log_group_retention_in_days" {
512+
description = "The number of days log events are kept in CloudWatch log group."
513+
default = 30
514+
type = number
515+
}

0 commit comments

Comments
 (0)