Skip to content

Commit 6e6663a

Browse files
authored
Exclude Name tag to prevent ALB conflicts (#44)
1 parent 5fb68ad commit 6e6663a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ github/
7676
*.ovpn
7777

7878
*.zip
79+
account-map/

src/main.tf

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ locals {
33

44
create_namespace = local.enabled && var.create_namespace
55

6-
kubernetes_namespace = local.create_namespace ? join("", kubernetes_namespace.default.*.id) : var.kubernetes_namespace
6+
kubernetes_namespace = local.create_namespace ? join("", kubernetes_namespace.default[*].id) : var.kubernetes_namespace
77

88
kubernetes_service_enabled = local.enabled && var.kubernetes_service_enabled
99

@@ -24,17 +24,20 @@ locals {
2424

2525
ingress_controller_group_name = try(coalesce(var.alb_group_name, module.this.name), module.this.name)
2626

27-
kube_tags = join(",", [for k, v in module.this.tags : "${k}=${v}"])
27+
# Exclude "Name" tag to avoid conflicts with ALB controller's IngressClassParams
28+
# The ALB controller applies its own "Name" tag via IngressClassParams, and having
29+
# conflicting "Name" tags prevents the ALB from being created/updated properly
30+
kube_tags = join(",", [for k, v in { for key, value in module.this.tags : key => value if key != "Name" } : "${k}=${v}"])
2831

2932
default_rule = "default-404-rule"
3033

3134
message_body = templatefile(var.fixed_response_template, var.fixed_response_vars)
3235

3336
# for outputs
34-
annotations = try(kubernetes_ingress_v1.default[0].metadata.0.annotations, null)
35-
group_name_annotation = try(lookup(kubernetes_ingress_v1.default[0].metadata.0.annotations, "alb.ingress.kubernetes.io/group.name", null), null)
36-
scheme_annotation = try(lookup(kubernetes_ingress_v1.default[0].metadata.0.annotations, "alb.ingress.kubernetes.io/scheme", null), null)
37-
class_annotation = try(lookup(kubernetes_ingress_v1.default[0].metadata.0.annotations, "kubernetes.io/ingress.class", null), null)
37+
annotations = try(kubernetes_ingress_v1.default[0].metadata[0].annotations, null)
38+
group_name_annotation = try(lookup(kubernetes_ingress_v1.default[0].metadata[0].annotations, "alb.ingress.kubernetes.io/group.name", null), null)
39+
scheme_annotation = try(lookup(kubernetes_ingress_v1.default[0].metadata[0].annotations, "alb.ingress.kubernetes.io/scheme", null), null)
40+
class_annotation = try(lookup(kubernetes_ingress_v1.default[0].metadata[0].annotations, "kubernetes.io/ingress.class", null), null)
3841
load_balancer_name = one(data.aws_lb.default[*].name)
3942
host = join(".", [module.this.environment, module.dns_delegated.outputs.default_domain_name])
4043
}

0 commit comments

Comments
 (0)