Skip to content

Unique target group IDs and health check config per target group #65

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

Merged
merged 4 commits into from
Apr 2, 2025
Merged

Unique target group IDs and health check config per target group #65

merged 4 commits into from
Apr 2, 2025

Conversation

nickreynke
Copy link
Contributor

@nickreynke nickreynke commented Apr 1, 2025

Changes made

  • Introduce random IDs for target groups to ensure unique naming with replacement on config changes.
  • Added validation for the name prefix to enforce a maximum length of 15 characters to not reach limit of target group names.
  • Added health check configuration per target group, overriding default target group health check configuration

Copilot summary:

This pull request includes several updates to the README.md and main.tf files to enhance the configuration and behavior of the load balancer and its associated resources. The most important changes include adding new requirements and providers, updating the input variables, and improving the configuration of target groups and listeners.

Updates to README.md:

  • Added new requirements for null and random providers and listed their versions.
  • Included new resources for null_resource and random_id in the resources section.
  • Updated the input variables http_ports and https_ports to include more detailed configuration options.
  • Specified a maximum length for the name_prefix input variable.
  • Added a new input variable for target_group_health_check_protocol.

Enhancements to main.tf:

  • Introduced null_resource and random_id resources to manage HTTP and HTTPS target group configurations and ensure unique naming. [1] [2]
  • Updated the aws_lb_target_group resources to use the new random_id for unique naming and improved health check configurations. [1] [2]
  • Modified the aws_lb_listener resources to directly use values from the configuration without lookup functions for redirect and fixed-response types. [1] [2] [3] [4]

Introduce random IDs for target groups to ensure unique naming with replacement on config changes. Added validation for the name prefix to enforce a maximum length of 15 characters. This change improves resource management and enforces stricter validation rules.
@jnonino jnonino added the enhancement New feature or request label Apr 1, 2025
@jnonino jnonino moved this from 🆕 New to 🏗 In progress in CN Services - Terraform Modules Apr 1, 2025
@jnonino jnonino self-requested a review April 1, 2025 21:54
Simplify attribute access in `main.tf` by replacing `lookup` calls with direct references to `each.value` properties. Updated `variables.tf` to define explicit object types, improving type safety and clarity for HTTP/HTTPS port variable definitions.
Enhanced health check configuration by allowing per-resource overrides using the `lookup` function. Introduced new optional variables for health check settings, providing greater flexibility and customization. This change ensures a more tailored setup for different target groups.
Improve clarity and provide protocol-specific details for GRPC. This ensures users understand the different allowed code ranges for HTTP/HTTPS and GRPC.
@nickreynke nickreynke marked this pull request as ready for review April 2, 2025 06:42
@nickreynke
Copy link
Contributor Author

Hey @jnonino! Another PR for review :) The only thing I am not sure about is #65 (comment)

@nickreynke
Copy link
Contributor Author

nickreynke commented Apr 2, 2025

The new unique naming concept for target groups fixes a bug where Terraform wants to replace the target group with another one with the same name. To make use of the create_before_destroy lifecycle I came up with the random id generation on configuration change. Thus enabling zero-downtime for target-groups.

@github-project-automation github-project-automation bot moved this from 🏗 In progress to 👀 In review in CN Services - Terraform Modules Apr 2, 2025
@jnonino jnonino merged commit 73c3ec0 into cn-terraform:main Apr 2, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in CN Services - Terraform Modules Apr 2, 2025
@nickreynke nickreynke deleted the feat/health-check-config-per-port branch April 2, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

2 participants