Fix TCP target group name exceeding AWS 32-char limit#98
Open
georgidimdimitrov wants to merge 1 commit into
Open
Fix TCP target group name exceeding AWS 32-char limit#98georgidimdimitrov wants to merge 1 commit into
georgidimdimitrov wants to merge 1 commit into
Conversation
The current pattern generates names like: twilight-paladin-6a43-tcp-tg-1024 (33 chars, > 32 limit) Use substr to cap the environment name prefix and drop the redundant -tg suffix: substr(env, 0, 19) + -tcp- + port = max 28 chars Fixes terraform apply failures for environment names >= 21 chars. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
aws_lb_target_group.tcpresource currently names target groups as:For environment names >= 21 characters (e.g.
twilight-paladin-6a43at 21 chars), the generated name reaches 33+ characters, exceeding AWS's 32-character limit and causingterraform applyto fail:Fix
Use Terraform's
substr()to cap the prefix and drop the redundant-tgsuffix (the resource type already identifies this as a target group):Maximum length: 19 + 5 (
-tcp-) + 4 (1028) = 28 chars, safely under the 32-char limit for any environment name.