Skip to content

Target Group is not updated nor is it destroyed #16120

@ghost

Description

Terraform Version

0.10.2

Terraform Configuration Files

port was changed from 1234:

resource "aws_alb_target_group" "alb-tg" {
  depends_on = ["module.database"]
  name     = "${var.environment_name}-test"
  port     = 4321
  protocol = "HTTP"
  vpc_id   = "${var.vpcid}"
 health_check {
   healthy_threshold   = "3"
   interval            = "30"
   matcher             = "200"
   path                = "/metadata"
   port                = "4321"
   protocol            = "HTTP"
   timeout             = "5"
   unhealthy_threshold = "2"
 }
}

resource "aws_alb_listener_rule" "test_host_based_routing" {
  listener_arn = "${var.alb_listener_arn}"
  priority     = 86

  action {
    type             = "forward"
    target_group_arn = "${aws_alb_target_group.alb-tg.arn}"
  }

  condition {
    field  = "host-header"
    values = ["test-api.${var.environment_name}.${var.subdomain}"]
  }
}

Expected Behavior

Terraform should be able to change the listener port for an existing target group. Or at least, delete the target group and create a new one with the new rules.

Actual Behavior

Error applying plan:

1 error(s) occurred:

* module.chat.aws_alb_target_group.alb-tg: 1 error(s) occurred:

* aws_alb_target_group.alb-tg: Error creating ALB Target Group: DuplicateTargetGroupName: A target group with the same name 'vpc-test' exists, but with different settings
	status code: 400, request id: 45238941-9cc0-11e7-a060-674673373add

Steps to Reproduce

  1. create a VPC with a target group listening on port 1234
  2. change the port listener in HCL code to 4321
  3. Terraform can't apply the change

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions