0

I am using terraform to create a vpc lattice service network and when I create a target group using this resource:

resource "aws_vpclattice_target_group" "internal_point_target_group" {
  name = "internal-point-target-group"
  type = "LAMBDA"
}

The target group is created just fine. However, anytime I run a terraform apply for any purpose, even with no actual changes. The target group wants to be replaced.

  # module.vpc_lattice.aws_vpclattice_target_group.internal_point_target_group must be replaced
+/- resource "aws_vpclattice_target_group" "internal_point_target_group" {
      ~ arn      = "arn:aws:vpc-lattice:us-east-2:##############:targetgroup/tg-###########" -> (known after apply)
      ~ id       = "tg-##############" -> (known after apply)
        name     = "internal-point-target-group"
      ~ status   = "ACTIVE" -> (known after apply)
      - tags     = {} -> null
        # (2 unchanged attributes hidden)

      - config {
          - port = 0 -> null
        }
    }

It looks like the target group id is changing, and in fact does destroy and create a new target group if I accept the apply.

I have tried several lifecycle ignore changes blocks with no luck. It also seems that there is no data for this resource so I am not sure how to query it to prevent it from redeploying on every apply. Any advice would be appreciated.

  • Did anything change in the Lambda function configuration? – Marko E Aug 24 '23 at 18:39
  • No, nothing has changed. I think it might be related to the config block in the resource as I am now working on adding an lattice target group for an ALB and it seems like the problem is not happening there. – stephen johnson Aug 24 '23 at 18:54
  • 1
    Yeah, what's interesting is that the documentation says the `config` block is not required when used with `type = "LAMBDA"`. You could maybe open a [bug](https://github.com/hashicorp/terraform-provider-aws/issues) and explain what's happening. – Marko E Aug 24 '23 at 18:55
  • Yeah, I think that is what is going to have to happen. It wont even let me ignore changes on the config block because it is not supported with LAMBDA. – stephen johnson Aug 24 '23 at 18:57

0 Answers0