Make target_group_port optional, if type not forward#68
Merged
jnonino merged 2 commits intocn-terraform:mainfrom Apr 3, 2025
Merged
Conversation
Updated the http_ports and https_ports variables to make target_group_port optional. Adjusted the filtering logic in resource blocks to handle cases where target_group_port is null. This change improves flexibility in defining listener configurations and prevents the creation of invalid resources.
Introduce validation rules to enforce `target_group_port` and `status_code` requirements based on `type` in `http_ports` and `https_ports`. Ensures stricter input validation to improve configuration accuracy and prevent misconfigurations.
jnonino
approved these changes
Apr 3, 2025
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.
Closes #67.
Copilot Summary
This pull request includes several changes to improve the configuration and validation of listener behaviors for HTTP and HTTPS ports in the load balancer module. The key changes involve making
target_group_portoptional and adding validation rules to ensure proper configuration.Improvements to listener configuration:
README.md: Updated the description ofhttp_portsandhttps_portsto reflect thattarget_group_portis now optional.variables.tf: Modified thehttp_portsandhttps_portsvariables to maketarget_group_portoptional and added validation rules to ensuretarget_group_portis set if the type isforward, andstatus_codeis set if the type isredirectorfixed-response. [1] [2] [3]Codebase simplification and validation:
main.tf: Updated the conditions for resourcesnull_resource.lb_http_tgs_config,random_id.lb_http_tgs_id,aws_lb_target_group.lb_http_tgs,null_resource.lb_https_tgs_config,random_id.lb_https_tgs_id, andaws_lb_target_group.lb_https_tgsto include a check thattarget_group_portis not null when the type isforward. [1] [2] [3] [4] [5] [6]