Aws vpc lattice target group resource in terraform destroys and adds itself on any apply even with no code changes

104 Views Asked by At

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.

0

There are 0 best solutions below