Skip to content
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

Crearting lambda as target group causes aws_lb_target_group issue on first apply #394

Open
scott-doyland-burrows opened this issue Dec 14, 2024 · 1 comment
Labels

Comments

@scott-doyland-burrows
Copy link

scott-doyland-burrows commented Dec 14, 2024

Versions

  • Module version [Required]:9.12.0

  • Terraform version:
    Terraform v1.10.0
    on linux_amd64

  • provider registry.terraform.io/hashicorp/aws v5.81.0
  • provider registry.terraform.io/hashicorp/external v2.3.4
  • provider registry.terraform.io/hashicorp/local v2.5.2
  • provider registry.terraform.io/hashicorp/null v3.2.3

Reproduction Code [Required]

module "alb" {
  source  = "terraform-aws-modules/alb/aws"
  version = "9.12.0"

  providers = {
    aws = aws.account
  }

  name    = local.name
  vpc_id  = module.vpc.vpc_id
  subnets = module.vpc.public_subnets

  target_groups = {
    session_manager_main = {
      name                     = "session-manager-main"
      target_type              = "lambda"
      target_id                = module.lambda.lambda_function_arn
      attach_lambda_permission = true
      port                     = null
    }
  }
}

Steps to reproduce the behavior:

terraform apply - warning on first run

Expected behavior

should apply without warning.

Actual behavior

│ Warning: Invalid Attribute Combination
│
│   with module.alb.aws_lb_target_group.this["session_manager_main"],
│   on .terraform/modules/alb/main.tf line 518, in resource "aws_lb_target_group" "this":
│  518:   port                               = try(each.value.target_type, null) == "lambda" ? null : try(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.

Additional context

A second (and any future) apply ran without errors. It is only the first apply that produces the error.

Looks like the use of port = null has maybe been deprecated completely when using lambda as a target group.

hashicorp/terraform-provider-aws#35457

Copy link

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant