Skip to content

Commit

Permalink
Merge pull request #12 from geekcell/fix-tags
Browse files Browse the repository at this point in the history
fix: Add more missing tags
  • Loading branch information
Ic3w0lf authored Sep 28, 2023
2 parents 6d2ebd3 + 8e33c14 commit 73ff07c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ preconfigured solution for seamless scalability and high availability."
|------|-------------|------|---------|:--------:|
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
Expand Down Expand Up @@ -145,14 +146,14 @@ preconfigured solution for seamless scalability and high availability."

## Resources

- resource.aws_cloudwatch_log_group.main (main.tf#306)
- resource.aws_codedeploy_app.main (main.tf#228)
- resource.aws_codedeploy_deployment_group.main (main.tf#235)
- resource.aws_ecs_service.main (main.tf#55)
- resource.aws_lb_listener.main (main.tf#175)
- resource.aws_lb_listener.test_listener (main.tf#201)
- resource.aws_lb_target_group.main (main.tf#132)
- resource.random_id.target_group (main.tf#121)
- resource.aws_cloudwatch_log_group.main (main.tf#309)
- resource.aws_codedeploy_app.main (main.tf#231)
- resource.aws_codedeploy_deployment_group.main (main.tf#238)
- resource.aws_ecs_service.main (main.tf#56)
- resource.aws_lb_listener.main (main.tf#176)
- resource.aws_lb_listener.test_listener (main.tf#202)
- resource.aws_lb_target_group.main (main.tf#133)
- resource.random_id.target_group (main.tf#122)
- data source.aws_subnet.main (data.tf#1)

# Examples
Expand Down
26 changes: 17 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ module "task_definition" {
proxy_configuration = var.task_proxy_configuration
additional_execute_role_policies = var.task_additional_execute_role_policies
additional_task_role_policies = var.task_additional_task_role_policies
tags = var.tags

tags = var.tags
}

#
Expand Down Expand Up @@ -100,18 +101,18 @@ resource "aws_ecs_service" "main" {
}
}

# Tags
enable_ecs_managed_tags = var.enable_ecs_managed_tags
propagate_tags = var.propagate_tags
tags = var.tags

lifecycle {
# These values will be updated by CodeDeploy after the initial setup and
# can not be touched directly by TF again
ignore_changes = [task_definition, network_configuration, load_balancer, desired_count]
}

depends_on = [module.task_definition, aws_lb_target_group.main]

# Tags
enable_ecs_managed_tags = var.enable_ecs_managed_tags
propagate_tags = var.propagate_tags
tags = var.tags
}

#
Expand Down Expand Up @@ -193,9 +194,9 @@ resource "aws_lb_listener" "main" {
ignore_changes = [default_action]
}

tags = var.tags

depends_on = [aws_lb_target_group.main]

tags = var.tags
}

resource "aws_lb_listener" "test_listener" {
Expand All @@ -220,6 +221,8 @@ resource "aws_lb_listener" "test_listener" {
}

depends_on = [aws_lb_target_group.main]

tags = var.tags
}

#
Expand Down Expand Up @@ -306,7 +309,10 @@ resource "aws_codedeploy_deployment_group" "main" {
resource "aws_cloudwatch_log_group" "main" {
count = var.create_cloudwatch_log_group ? 1 : 0

name = coalesce(var.cloudwatch_log_group_name, "/aws/ecs/${var.ecs_cluster_name}/${var.name}")
name = coalesce(var.cloudwatch_log_group_name, "/aws/ecs/${var.ecs_cluster_name}/${var.name}")
retention_in_days = var.cloudwatch_log_group_retention_in_days

tags = var.tags
}

#
Expand All @@ -321,4 +327,6 @@ module "iam_role_codedeploy" {

assume_roles = { "Service" : { identifiers = ["codedeploy.amazonaws.com"] } }
policy_arns = ["arn:aws:iam::aws:policy/AWSCodeDeployRoleForECS"]

tags = var.tags
}
7 changes: 6 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ variable "codedeploy_cloudwatch_alarm_names" {
type = list(string)
}


# TARGET GROUP
variable "target_group_load_balancing_algorithm_type" {
description = "Determines how the load balancer selects targets when routing requests."
Expand Down Expand Up @@ -508,3 +507,9 @@ variable "cloudwatch_log_group_name" {
default = null
type = string
}

variable "cloudwatch_log_group_retention_in_days" {
description = "The number of days log events are kept in CloudWatch log group."
default = 30
type = number
}

0 comments on commit 73ff07c

Please sign in to comment.