Update to alb module 9.17.0 (#98)
This commit is contained in:
1 parent
a4647fb2d4
commit
762f716442
6 files changed
+273
-73
No files matched your search
+53
-35
@@ -1,7 +1,7 @@
|
||||
locals {
|
||||
fleet_config = merge(var.fleet_config, {
|
||||
loadbalancer = {
|
||||
arn = module.alb.target_group_arns[0]
|
||||
arn = module.alb.target_groups["tg-0"].arn
|
||||
},
|
||||
networking = merge(var.fleet_config.networking, {
|
||||
subnets = var.fleet_config.networking.subnets
|
||||
@@ -14,7 +14,28 @@ locals {
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
fleet_target_group = [
|
||||
{
|
||||
name = var.alb_config.name
|
||||
backend_protocol = "HTTP"
|
||||
backend_port = 80
|
||||
target_type = "ip"
|
||||
create_attachment = false
|
||||
health_check = {
|
||||
path = "/healthz"
|
||||
matcher = "200"
|
||||
timeout = 10
|
||||
interval = 15
|
||||
healthy_threshold = 5
|
||||
unhealthy_threshold = 5
|
||||
}
|
||||
}
|
||||
]
|
||||
target_groups = { for idx, tg in concat(local.fleet_target_group, var.alb_config.extra_target_groups) :
|
||||
"tg-${idx}" => merge(tg, {
|
||||
create_attachment = try(tg.create_attachment, false)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module "ecs" {
|
||||
@@ -41,7 +62,7 @@ module "cluster" {
|
||||
|
||||
module "alb" {
|
||||
source = "terraform-aws-modules/alb/aws"
|
||||
version = "8.3.0"
|
||||
version = "9.17.0"
|
||||
|
||||
name = var.alb_config.name
|
||||
|
||||
@@ -53,39 +74,12 @@ module "alb" {
|
||||
access_logs = var.alb_config.access_logs
|
||||
idle_timeout = var.alb_config.idle_timeout
|
||||
|
||||
target_groups = concat([
|
||||
{
|
||||
name = var.alb_config.name
|
||||
backend_protocol = "HTTP"
|
||||
backend_port = 80
|
||||
target_type = "ip"
|
||||
health_check = {
|
||||
path = "/healthz"
|
||||
matcher = "200"
|
||||
timeout = 10
|
||||
interval = 15
|
||||
healthy_threshold = 5
|
||||
unhealthy_threshold = 5
|
||||
}
|
||||
}
|
||||
], var.alb_config.extra_target_groups)
|
||||
target_groups = local.target_groups
|
||||
|
||||
# Require TLS 1.2 as earlier versions are insecure
|
||||
listener_ssl_policy_default = var.alb_config.tls_policy
|
||||
xff_header_processing_mode = var.alb_config.xff_header_processing_mode
|
||||
|
||||
https_listeners = [
|
||||
{
|
||||
port = 443
|
||||
protocol = "HTTPS"
|
||||
certificate_arn = var.alb_config.certificate_arn
|
||||
target_group_index = 0
|
||||
}
|
||||
]
|
||||
|
||||
https_listener_rules = var.alb_config.https_listener_rules
|
||||
|
||||
http_tcp_listeners = [
|
||||
{
|
||||
listeners = {
|
||||
http = {
|
||||
port = 80
|
||||
protocol = "HTTP"
|
||||
action_type = "redirect"
|
||||
@@ -95,7 +89,31 @@ module "alb" {
|
||||
status_code = "HTTP_301"
|
||||
}
|
||||
}
|
||||
]
|
||||
https = merge({
|
||||
# Require TLS 1.2 as earlier versions are insecure
|
||||
ssl_policy = var.alb_config.tls_policy
|
||||
port = 443
|
||||
protocol = "HTTPS"
|
||||
certificate_arn = var.alb_config.certificate_arn
|
||||
forward = {
|
||||
target_group_key = "tg-0"
|
||||
}
|
||||
rules = { for idx, rule in var.alb_config.https_listener_rules :
|
||||
"rule-${idx}" => merge(rule, {
|
||||
conditions = [for condition in rule.conditions : {
|
||||
for k, v in condition :
|
||||
"${trimsuffix(k, "s")}" => { values = v }
|
||||
}]
|
||||
actions = [for action in rule.actions : merge(action, {
|
||||
target_group_key = try(action.target_group_key, try("tg-${action.target_group_index}", null))
|
||||
})]
|
||||
})
|
||||
}
|
||||
}, var.alb_config.https_overrides)
|
||||
}
|
||||
tags = {
|
||||
Name = var.alb_config.name
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_security_group" "alb" {
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener.frontend_http_tcp[0]
|
||||
to = module.alb.aws_lb_listener.this["http"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener.frontend_https[0]
|
||||
to = module.alb.aws_lb_listener.this["https"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_target_group.main[0]
|
||||
to = module.alb.aws_lb_target_group.this["tg-0"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_target_group.main[1]
|
||||
to = module.alb.aws_lb_target_group.this["tg-1"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[0]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-0"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[1]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-1"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[2]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-2"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[3]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-3"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[4]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-4"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[5]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-5"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[6]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-6"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[7]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-7"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[8]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-8"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[9]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-9"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[10]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-10"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[11]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-11"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[12]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-12"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[13]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-13"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[14]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-14"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[15]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-15"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[16]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-16"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[17]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-17"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[18]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-18"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[19]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-19"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[20]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-20"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[21]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-21"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[22]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-22"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[23]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-23"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[24]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-24"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[25]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-25"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[26]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-26"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[27]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-27"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[28]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-28"]
|
||||
}
|
||||
|
||||
moved {
|
||||
from = module.alb.aws_lb_listener_rule.https_listener_rule[29]
|
||||
to = module.alb.aws_lb_listener_rule.this["https/rule-29"]
|
||||
}
|
||||
@@ -7,5 +7,12 @@ output "cluster" {
|
||||
}
|
||||
|
||||
output "alb" {
|
||||
value = module.alb
|
||||
value = merge(module.alb, {
|
||||
lb_dns_name = module.alb.dns_name
|
||||
lb_zone_id = module.alb.zone_id
|
||||
target_group_names = [for k, tg in module.alb.target_groups : tg.name]
|
||||
target_group_arn_suffixes = [for k, tg in module.alb.target_groups : tg.arn_suffix]
|
||||
target_group_arns = [for k, tg in module.alb.target_groups : tg.arn]
|
||||
lb_arn_suffix = module.alb.arn_suffix
|
||||
})
|
||||
}
|
||||
+15
-13
@@ -309,18 +309,20 @@ variable "migration_config" {
|
||||
|
||||
variable "alb_config" {
|
||||
type = object({
|
||||
name = optional(string, "fleet")
|
||||
subnets = list(string)
|
||||
security_groups = optional(list(string), [])
|
||||
access_logs = optional(map(string), {})
|
||||
certificate_arn = string
|
||||
allowed_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
allowed_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
egress_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
egress_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
extra_target_groups = optional(any, [])
|
||||
https_listener_rules = optional(any, [])
|
||||
tls_policy = optional(string, "ELBSecurityPolicy-TLS13-1-2-2021-06")
|
||||
idle_timeout = optional(number, 905)
|
||||
name = optional(string, "fleet")
|
||||
subnets = list(string)
|
||||
security_groups = optional(list(string), [])
|
||||
access_logs = optional(map(string), {})
|
||||
certificate_arn = string
|
||||
allowed_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
allowed_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
egress_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
egress_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
extra_target_groups = optional(any, [])
|
||||
https_listener_rules = optional(any, [])
|
||||
https_overrides = optional(any, {})
|
||||
xff_header_processing_mode = optional(string, null)
|
||||
tls_policy = optional(string, "ELBSecurityPolicy-TLS13-1-2-2021-06")
|
||||
idle_timeout = optional(number, 905)
|
||||
})
|
||||
}
|
||||
+15
-13
@@ -414,18 +414,20 @@ variable "migration_config" {
|
||||
|
||||
variable "alb_config" {
|
||||
type = object({
|
||||
name = optional(string, "fleet")
|
||||
subnets = list(string)
|
||||
security_groups = optional(list(string), [])
|
||||
access_logs = optional(map(string), {})
|
||||
certificate_arn = string
|
||||
allowed_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
allowed_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
egress_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
egress_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
extra_target_groups = optional(any, [])
|
||||
https_listener_rules = optional(any, [])
|
||||
tls_policy = optional(string, "ELBSecurityPolicy-TLS13-1-2-2021-06")
|
||||
idle_timeout = optional(number, 905)
|
||||
name = optional(string, "fleet")
|
||||
subnets = list(string)
|
||||
security_groups = optional(list(string), [])
|
||||
access_logs = optional(map(string), {})
|
||||
certificate_arn = string
|
||||
allowed_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
allowed_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
egress_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
egress_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
extra_target_groups = optional(any, [])
|
||||
https_listener_rules = optional(any, [])
|
||||
https_overrides = optional(any, {})
|
||||
xff_header_processing_mode = optional(string, null)
|
||||
tls_policy = optional(string, "ELBSecurityPolicy-TLS13-1-2-2021-06")
|
||||
idle_timeout = optional(number, 905)
|
||||
})
|
||||
}
|
||||
+13
-11
@@ -462,17 +462,19 @@ variable "migration_config" {
|
||||
|
||||
variable "alb_config" {
|
||||
type = object({
|
||||
name = optional(string, "fleet")
|
||||
security_groups = optional(list(string), [])
|
||||
access_logs = optional(map(string), {})
|
||||
allowed_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
allowed_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
egress_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
egress_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
extra_target_groups = optional(any, [])
|
||||
https_listener_rules = optional(any, [])
|
||||
tls_policy = optional(string, "ELBSecurityPolicy-TLS13-1-2-2021-06")
|
||||
idle_timeout = optional(number, 905)
|
||||
name = optional(string, "fleet")
|
||||
security_groups = optional(list(string), [])
|
||||
access_logs = optional(map(string), {})
|
||||
allowed_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
allowed_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
egress_cidrs = optional(list(string), ["0.0.0.0/0"])
|
||||
egress_ipv6_cidrs = optional(list(string), ["::/0"])
|
||||
extra_target_groups = optional(any, [])
|
||||
https_listener_rules = optional(any, [])
|
||||
https_overrides = optional(any, {})
|
||||
xff_header_processing_mode = optional(string, null)
|
||||
tls_policy = optional(string, "ELBSecurityPolicy-TLS13-1-2-2021-06")
|
||||
idle_timeout = optional(number, 905)
|
||||
})
|
||||
default = {}
|
||||
}
|
||||
Reference in new issue
Block a user