From 7e75eec8a67bc428263e73320922a279081ac0bb Mon Sep 17 00:00:00 2001 From: Andres Alvarez <113357990+aalvarezaph@users.noreply.github.com> Date: Thu, 18 Jan 2024 02:03:23 +0100 Subject: [PATCH] feat: Configurable default action https listener (#391) feat: configurable default action https listener Make the ALB https listener default action configurable --- README.md | 1 + main.tf | 5 +---- variables.tf | 10 ++++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 869cc806..03c27cc3 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ No resources. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [alb](#input\_alb) | Map of values passed to ALB module definition. See the [ALB module](https://github.com/terraform-aws-modules/terraform-aws-alb) for full list of arguments supported | `any` | `{}` | no | +| [alb\_https\_default\_action](#input\_alb\_https\_default\_action) | Default action for the ALB https listener | `any` |
{
"forward": {
"target_group_key": "atlantis"
}
}
| no | | [alb\_security\_group\_id](#input\_alb\_security\_group\_id) | ID of an existing security group that will be used by ALB. Required if `create_alb` is `false` | `string` | `""` | no | | [alb\_subnets](#input\_alb\_subnets) | List of subnets to place ALB in. Required if `create_alb` is `true` | `list(string)` | `[]` | no | | [alb\_target\_group\_arn](#input\_alb\_target\_group\_arn) | ARN of an existing ALB target group that will be used to route traffic to the Atlantis service. Required if `create_alb` is `false` | `string` | `""` | no | diff --git a/main.tf b/main.tf index ff312640..f6d14392 100644 --- a/main.tf +++ b/main.tf @@ -78,11 +78,8 @@ module "alb" { protocol = "HTTPS" ssl_policy = try(var.alb.https_listener_ssl_policy, "ELBSecurityPolicy-TLS13-1-2-Res-2021-06") certificate_arn = var.create_certificate ? module.acm.acm_certificate_arn : var.certificate_arn - - forward = { - target_group_key = "atlantis" - } }, + var.alb_https_default_action, lookup(var.alb, "https_listener", {}) ) }, diff --git a/variables.tf b/variables.tf index 5a34dbe3..f18e1867 100644 --- a/variables.tf +++ b/variables.tf @@ -68,6 +68,16 @@ variable "alb" { default = {} } +variable "alb_https_default_action" { + description = "Default action for the ALB https listener" + type = any + default = { + forward = { + target_group_key = "atlantis" + } + } +} + variable "alb_subnets" { description = "List of subnets to place ALB in. Required if `create_alb` is `true`" type = list(string)