Skip to content

Commit

Permalink
feat: expose alb health check settings (#126)
Browse files Browse the repository at this point in the history
## Description
<!--- Describe your changes in detail -->

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## Breaking Changes
<!-- Does this break backwards compatibility with the current major
version? -->
<!-- If so, please provide an explanation why it is necessary. -->

## How Has This Been Tested?
- [ ] I have updated at least one of the `examples/*` to demonstrate and
validate my change(s)
- [ ] I have tested and validated these changes using one or more of the
provided `examples/*` projects
<!--- Users should start with an existing example as its written, deploy
it, then check their changes against it -->
<!--- This will highlight breaking/disruptive changes. Once you have
checked, deploy your changes to verify -->
<!--- Please describe how you tested your changes -->
- [ ] I have executed `pre-commit run -a` on my pull request
<!--- Please see
https://github.com/antonbabenko/pre-commit-terraform#how-to-install for
how to install -->
  • Loading branch information
applike-ss authored Aug 2, 2024
1 parent cc0f17e commit 66e0811
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .tflint.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugin "aws" {

plugin "terraform" {
enabled = true
version = "0.8.0"
version = "0.9.0"
source = "github.com/terraform-linters/tflint-ruleset-terraform"
}

Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
terraform 1.9.2
terraform 1.9.3
terraform-docs 0.18.0
tflint 0.52.0
pre-commit 3.7.1
pre-commit 3.8.0
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Terraform module which creates a ecs app
| <a name="requirement_elasticsearch"></a> [elasticsearch](#requirement\_elasticsearch) | 2.0.7 |
| <a name="requirement_elasticstack"></a> [elasticstack](#requirement\_elasticstack) | 0.11.4 |
| <a name="requirement_gosoline"></a> [gosoline](#requirement\_gosoline) | 1.3.0 |
| <a name="requirement_grafana"></a> [grafana](#requirement\_grafana) | 2.13.0 |
| <a name="requirement_sentry"></a> [sentry](#requirement\_sentry) | 0.12.2 |
| <a name="requirement_grafana"></a> [grafana](#requirement\_grafana) | 3.7.0 |
| <a name="requirement_sentry"></a> [sentry](#requirement\_sentry) | 0.13.1 |

## Providers

Expand All @@ -29,7 +29,7 @@ Terraform module which creates a ecs app
| <a name="module_cloudwatch_label"></a> [cloudwatch\_label](#module\_cloudwatch\_label) | justtrackio/label/null | 0.26.0 |
| <a name="module_container_definition"></a> [container\_definition](#module\_container\_definition) | cloudposse/ecs-container-definition/aws | 0.61.1 |
| <a name="module_container_definition_fluentbit"></a> [container\_definition\_fluentbit](#module\_container\_definition\_fluentbit) | cloudposse/ecs-container-definition/aws | 0.61.1 |
| <a name="module_ecr"></a> [ecr](#module\_ecr) | terraform-aws-modules/ecr/aws | 1.6.0 |
| <a name="module_ecr"></a> [ecr](#module\_ecr) | terraform-aws-modules/ecr/aws | 2.2.1 |
| <a name="module_ecr_label"></a> [ecr\_label](#module\_ecr\_label) | justtrackio/label/null | 0.26.0 |
| <a name="module_ecs_label"></a> [ecs\_label](#module\_ecs\_label) | justtrackio/label/null | 0.26.0 |
| <a name="module_ecs_service_task_customized_autoscaling"></a> [ecs\_service\_task\_customized\_autoscaling](#module\_ecs\_service\_task\_customized\_autoscaling) | justtrackio/ecs-autoscaling/aws | 1.2.0 |
Expand Down Expand Up @@ -73,9 +73,7 @@ Terraform module which creates a ecs app
| <a name="input_alarm_service_resources_memory_average"></a> [alarm\_service\_resources\_memory\_average](#input\_alarm\_service\_resources\_memory\_average) | Average MemoryUtilization alarm specs | <pre>object({<br> datapoints_to_alarm = optional(number, 6)<br> evaluation_periods = optional(number, 6)<br> period = optional(number, 300)<br> threshold = optional(number, 125)<br> })</pre> | <pre>{<br> "datapoints_to_alarm": 6,<br> "evaluation_periods": 6,<br> "period": 300,<br> "threshold": 125<br>}</pre> | no |
| <a name="input_alarm_service_resources_memory_maximum"></a> [alarm\_service\_resources\_memory\_maximum](#input\_alarm\_service\_resources\_memory\_maximum) | Maximum MemoryUtilization alarm specs | <pre>object({<br> datapoints_to_alarm = optional(number, 15)<br> evaluation_periods = optional(number, 15)<br> period = optional(number, 60)<br> threshold = optional(number, 150)<br> })</pre> | <pre>{<br> "datapoints_to_alarm": 15,<br> "evaluation_periods": 15,<br> "period": 60,<br> "threshold": 150<br>}</pre> | no |
| <a name="input_alarm_service_resources_treat_missing_data"></a> [alarm\_service\_resources\_treat\_missing\_data](#input\_alarm\_service\_resources\_treat\_missing\_data) | How to treat missing data, defaults to 'breaching' | `string` | `"breaching"` | no |
| <a name="input_alb_health_check_interval"></a> [alb\_health\_check\_interval](#input\_alb\_health\_check\_interval) | The duration in seconds in between health checks | `number` | `30` | no |
| <a name="input_alb_health_check_matcher"></a> [alb\_health\_check\_matcher](#input\_alb\_health\_check\_matcher) | The HTTP response codes to indicate a healthy check | `string` | `"200"` | no |
| <a name="input_alb_health_check_path"></a> [alb\_health\_check\_path](#input\_alb\_health\_check\_path) | The destination for the health check request | `string` | `"/health"` | no |
| <a name="input_alb_health_check"></a> [alb\_health\_check](#input\_alb\_health\_check) | ALB target group healthy check values | <pre>object({<br> enabled = optional(bool, true)<br> healthy_threshold = optional(number, 2)<br> unhealthy_threshold = optional(number, 2)<br> threshold = optional(number, 2)<br> interval = optional(number, 30)<br> timeout = optional(number, 10)<br> matcher = optional(string, "200")<br> path = optional(string, "/health")<br> port = optional(string, "traffic-port")<br> protocol = optional(string, "HTTP")<br> })</pre> | `{}` | no |
| <a name="input_alb_name"></a> [alb\_name](#input\_alb\_name) | Name of the alb used to attach the target group | `string` | `""` | no |
| <a name="input_alb_stickiness_enabled"></a> [alb\_stickiness\_enabled](#input\_alb\_stickiness\_enabled) | Boolean to enable / disable `stickiness`. Default is `true` | `bool` | `false` | no |
| <a name="input_alb_unauthenticated_hosts"></a> [alb\_unauthenticated\_hosts](#input\_alb\_unauthenticated\_hosts) | Unauthenticated hosts to match in Hosts header | `list(string)` | `[]` | no |
Expand Down
12 changes: 9 additions & 3 deletions alb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ module "alb_ingress" {
unauthenticated_hosts = var.alb_unauthenticated_hosts
unauthenticated_listener_arns = [data.aws_lb_listener.http[0].arn, data.aws_lb_listener.https[0].arn]

health_check_path = var.alb_health_check_path
health_check_matcher = var.alb_health_check_matcher
health_check_interval = var.alb_health_check_interval
health_check_enabled = var.alb_health_check.enabled
health_check_healthy_threshold = var.alb_health_check.healthy_threshold
health_check_interval = var.alb_health_check.interval
health_check_matcher = var.alb_health_check.matcher
health_check_path = var.alb_health_check.path
health_check_port = var.alb_health_check.port
health_check_protocol = var.alb_health_check.protocol
health_check_timeout = var.alb_health_check.timeout
health_check_unhealthy_threshold = var.alb_health_check.unhealthy_threshold

stickiness_enabled = var.alb_stickiness_enabled
}
2 changes: 1 addition & 1 deletion ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module "ecr_label" {

module "ecr" {
source = "terraform-aws-modules/ecr/aws"
version = "1.6.0"
version = "2.2.1"

repository_name = module.ecr_label.id
tags = module.ecr_label.tags
Expand Down
31 changes: 15 additions & 16 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,21 @@ variable "alarm_service_resources_treat_missing_data" {
description = "How to treat missing data, defaults to 'breaching'"
}

variable "alb_health_check_interval" {
type = number
default = 30
description = "The duration in seconds in between health checks"
}

variable "alb_health_check_matcher" {
type = string
default = "200"
description = "The HTTP response codes to indicate a healthy check"
}

variable "alb_health_check_path" {
type = string
default = "/health"
description = "The destination for the health check request"
variable "alb_health_check" {
type = object({
enabled = optional(bool, true)
healthy_threshold = optional(number, 2)
unhealthy_threshold = optional(number, 2)
threshold = optional(number, 2)
interval = optional(number, 30)
timeout = optional(number, 10)
matcher = optional(string, "200")
path = optional(string, "/health")
port = optional(string, "traffic-port")
protocol = optional(string, "HTTP")
})
default = {}
description = "ALB target group healthy check values"
}

variable "alb_name" {
Expand Down
4 changes: 2 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ terraform {

grafana = {
source = "grafana/grafana"
version = "2.13.0"
version = "3.7.0"
}

elasticstack = {
Expand All @@ -27,7 +27,7 @@ terraform {

sentry = {
source = "jianyuan/sentry"
version = "0.12.2"
version = "0.13.1"
}
}

Expand Down

0 comments on commit 66e0811

Please sign in to comment.