-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Exclude Name tag to prevent ALB conflicts
#44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughUpdated .gitignore to ignore the account-map/ directory. In Terraform, adjusted splat/indexing syntax for Kubernetes namespace and metadata lookups, and modified tag construction to exclude the "Name" tag. Added inline comments explaining these Terraform expression changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/terratest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
.gitignore (1)
79-79: Ignore rule LGTM; consider anchoring to repo root and mirroring in .dockerignore
account-map/will ignore any directory namedaccount-mapat any depth. If you intend only the repo‑root dir, prefer/account-map/. Also add the same to.dockerignoreif applicable.src/main.tf (4)
6-6: Use one(...) instead of join("", list) for single-element extractionFor consistency with later usage (
one(data.aws_lb.default[*].name)), this reads clearer and asserts cardinality.- kubernetes_namespace = local.create_namespace ? join("", kubernetes_namespace.default[*].id) : var.kubernetes_namespace + kubernetes_namespace = local.create_namespace ? one(kubernetes_namespace.default[*].id) : var.kubernetes_namespace
27-30: Exclude “Name” tag: simplify comprehension and align formattingLogic is correct. You can simplify the map/list comp and keep behavior identical. Optional: guard against accidental case variants if your tag source ever varies.
- kube_tags = join(",", [for k, v in { for key, value in module.this.tags : key => value if key != "Name" } : "${k}=${v}"]) + # Build "k=v,k2=v2" string from tags excluding the AWS-reserved/conflicting Name tag + kube_tags = join( + ",", + [for k, v in module.this.tags : "${k}=${v}" if k != "Name"] + ) + # If your tag keys could be case-variant, consider: if lower(k) != "name"Please verify none of the tag values contain commas or equal signs; ALB tag annotation parsing is CSV-like and will break on those.
201-204: Nit: Prefer one(...) over join("", ...) for LB ID as wellNot a blocker; improves clarity and parity with
one(...)elsewhere.- endpoint_id = join("", data.aws_lb.default[*].id) + endpoint_id = one(data.aws_lb.default[*].id)
51-52: Side note: Kubernetes label constraints vs. module tagsUnchanged in this PR, but
labels = module.this.tagsmay include keys likeNamethat aren’t valid Kubernetes label keys (must be DNS‑1123 compliant). If you haven’t already, consider a sanitized projection for labels.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.gitignore(1 hunks)src/main.tf(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Summary
🔇 Additional comments (1)
src/main.tf (1)
36-41: Bracket indexing for metadata access LGTMSwitch to
metadata[0].annotationsresolves tflint/HCL indexing warnings and is robust behindtry(...).
|
These changes were released in v1.537.0. |
what
Namefrom tagstflintwarningswhy
Services like
echo-serverwere usingk8s-commonALB instead of the provisionedalb-controller-ingress-groupALB, despite havingingress_type: "alb"configured.The root cause was tag conflicts: the ALB Controller's
defaultTags(frommodule.this.tags) appliedName: acme-plat-euc1-dev, while the ALB controller ingress group applied Name:acme-plat-euc1-dev-alb-controller-ingress-group. These conflictingNametags prevented the AWS Load Balancer Controller from reconciling ingresses into the target group.Ingresses should manage their own tags rather than inheriting the tags from this component.
references
Summary by CodeRabbit