Skip to content

Conversation

@thiago4go
Copy link
Contributor

Add support for custom target group in internal ALB listener

Summary

Adds alb_internal_default_target_group_arn variable to allow users to specify a custom target group ARN for the internal ALB HTTPS listener default action.

Motivation

When using external deployment tools (e.g., GitHub Actions, CodeDeploy) that manage ALB listener routing, Terraform would revert the listener's default action back to the module-created default target group on subsequent runs. This change allows users to align Terraform configuration with externally managed listener configurations.

Changes

  • Added alb_internal_default_target_group_arn variable to _variables.tf
  • Modified alb-internal.tf to use the custom target group ARN when provided
  • Falls back to module-created default target group when variable is empty (backward compatible)

Usage Example

hcl
module "ecs_cluster" {
source = "git::https://github.com/DNXLabs/terraform-aws-ecs.git?ref=6.20.1"

name = "my-cluster"
alb_internal = true
alb_internal_default_target_group_arn = "arn:aws:elasticloadbalancing:region:account:targetgroup/my-app/abc123"

... other variables

}

Backward Compatibility

Fully backward compatible. When alb_internal_default_target_group_arn is not set or empty, behavior remains unchanged.

Testing

  • Verified variable defaults to empty string
  • Confirmed ternary operator correctly selects custom ARN when provided
  • Validated fallback to default target group when variable is empty

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

Types of changes

What types of changes does your code introduce to <repo_name>?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING.md doc.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Allow users to specify a custom target group ARN for the internal ALB
HTTPS listener default action. If not specified, falls back to the
default target group created by the module.

This enables external deployment tools (e.g., GitHub Actions) to manage
the listener default action without Terraform reverting changes.
@amazon-q-developer
Copy link

Code review in progress. Analyzing for code quality issues and best practices. You can monitor the review status in the checks section at the bottom of this pull request. Detailed findings will be posted upon completion.

Using Amazon Q Developer for GitHub

Amazon Q Developer1 is an AI-powered assistant that integrates directly into your GitHub workflow, enhancing your development process with intelligent features for code development, review, and transformation.

Slash Commands

Command Description
/q <message> Chat with the agent to ask questions or request revisions
/q review Requests an Amazon Q powered code review
/q help Displays usage information

Features

Agentic Chat
Enables interactive conversation with Amazon Q to ask questions about the pull request or request specific revisions. Use /q <message> in comment threads or the review body to engage with the agent directly.

Code Review
Analyzes pull requests for code quality, potential issues, and security concerns. Provides feedback and suggested fixes. Automatically triggered on new or reopened PRs (can be disabled for AWS registered installations), or manually with /q review slash command in a comment.

Customization

You can create project-specific rules for Amazon Q Developer to follow:

  1. Create a .amazonq/rules folder in your project root.
  2. Add Markdown files in this folder to define rules (e.g., cdk-rules.md).
  3. Write detailed prompts in these files, such as coding standards or best practices.
  4. Amazon Q Developer will automatically use these rules when generating code or providing assistance.

Example rule:

All Amazon S3 buckets must have encryption enabled, enforce SSL, and block public access.
All Amazon DynamoDB Streams tables must have encryption enabled.
All Amazon SNS topics must have encryption enabled and enforce SSL.
All Amazon SNS queues must enforce SSL.

Feedback

To provide feedback on Amazon Q Developer, create an issue in the Amazon Q Developer public repository.

For more detailed information, visit the Amazon Q for GitHub documentation.

Footnotes

  1. Amazon Q Developer uses generative AI. You may need to verify generated code before using it in your environment. See the AWS Responsible AI Policy.

Copy link
Contributor

@jeremiasroma jeremiasroma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@thiago4go thiago4go merged commit 0c80589 into master Oct 22, 2025
@amazon-q-developer
Copy link

⚠️ Review Failed

I was unable to finalize my review because the pull request head or merge base was modified since I began my review. Please try again.

Request ID: a9abb22d-377a-584a-a198-d35e46da4b71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants