Skip to content

Conversation

flora-five
Copy link
Contributor

Description

The complete-alb example needs a few fixes to apply without errors.

Motivation and Context

terraform apply returns a warning and some errors:

╷
│ Warning: Invalid Attribute Combination
│ 
│   with module.alb.aws_lb_target_group.this["ex-lambda-with-trigger"],
│   on ../../main.tf line 578, in resource "aws_lb_target_group" "this":
│  578:   port                               = each.value.target_type == "lambda" ? null : coalesce(each.value.port, var.default_port)
│ 
│ Attribute "port" cannot be specified when "target_type" is "lambda".
│ 
│ This will be an error in a future release.
│ 
│ (and one more similar warning elsewhere)
╵
╷
│ Error: Missing required argument
│ 
│   with module.alb.aws_lb_listener_rule.this["ex-http-https-redirect/ex-weighted-forward"],
│   on ../../main.tf line 299, in resource "aws_lb_listener_rule" "this":
│  299: resource "aws_lb_listener_rule" "this" {
│ 
│ The argument "action.0.forward.0.target_group.0.arn" is required, but no
│ definition was found.
╵
╷
│ Error: Missing required argument
│ 
│   with module.alb.aws_lb_listener_rule.this["ex-http-https-redirect/ex-weighted-forward"],
│   on ../../main.tf line 299, in resource "aws_lb_listener_rule" "this":
│  299: resource "aws_lb_listener_rule" "this" {
│ 
│ The argument "action.0.forward.0.target_group.1.arn" is required, but no
│ definition was found.
╵
╷
│ Error: Only one of host_header, http_header, http_request_method, path_pattern, query_string or source_ip can be set in a condition block
│ 
│   with module.alb.aws_lb_listener_rule.this["ex-https/ex-weighted-forward"],
│   on ../../main.tf line 299, in resource "aws_lb_listener_rule" "this":
│  299: resource "aws_lb_listener_rule" "this" {
│ 

Breaking Changes

None

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

}
}]

conditions = [{
Copy link
Member

Choose a reason for hiding this comment

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

this is a no-op, correct? do we need this change for the fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's needed to fix Error: Only one of host_header, http_header, http_request_method, path_pattern, query_string or source_ip can be set in a condition block.

Without the change the module generates one condition block, like this:

condition {
  query_string = ...
  path_pattern = ...
}

which is not correct. Two condition blocks must be used.

@bryantbiggs bryantbiggs changed the title fix: Update the complete-alb example to apply without errors docs: Update the complete-alb example to apply without errors Oct 1, 2025
@bryantbiggs bryantbiggs merged commit a13bc10 into terraform-aws-modules:master Oct 1, 2025
10 checks passed
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.

2 participants