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

Removing target groups from aws_autoscaling_group does not remove it on AWS #3265

Closed
JoelSpeed opened this issue Feb 6, 2018 · 6 comments · Fixed by #14064
Closed

Removing target groups from aws_autoscaling_group does not remove it on AWS #3265

JoelSpeed opened this issue Feb 6, 2018 · 6 comments · Fixed by #14064
Assignees
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service. service/elbv2 Issues and PRs that pertain to the elbv2 service.
Milestone

Comments

@JoelSpeed
Copy link

I've tested this a couple of times. Attaching an NLB to the ASG using a target group and then removing it again, terraform does not remove it from AWS

Terraform Version

v0.11.1

Affected Resource(s)

Please list the resources as a list, for example:

  • aws_autoscaling_group

Terraform Configuration Files

resource "aws_autoscaling_group" "controllers" {
  name                      = "${var.cluster_name}-controllers"
  launch_configuration      = "${aws_launch_configuration.controllers.name}"
  min_size                  = "${var.min_controllers}"
  max_size                  = "${var.max_controllers}"
  health_check_type         = "EC2"
  health_check_grace_period = 600
  wait_for_capacity_timeout = "10m"
  load_balancers            = ["${aws_elb.apiserver_elb.name}"]
  target_group_arns         = ["${aws_lb_target_group.apiserver_lb_internal.arn}"]
  vpc_zone_identifier       = ["${aws_subnet.cluster_subnets.*.id}"]

  enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupStandbyInstances", "GroupTotalInstances"]

  tag {
    key                 = "KubernetesCluster"
    value               = "${var.cluster_name}"
    propagate_at_launch = true
  }

  tag {
    key                 = "Role"
    value               = "Controller"
    propagate_at_launch = true
  }
}

Expected Behavior

Terraform should have removed the target group from the ASG on AWS

Actual Behavior

The ASG remained attached to the ASG

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
  2. comment out target_group_arns
  3. terraform apply - nothing to change
@bflad bflad added bug Addresses a defect in current functionality. service/elbv2 Issues and PRs that pertain to the elbv2 service. service/autoscaling Issues and PRs that pertain to the autoscaling service. labels Feb 6, 2018
@samjgalbraith
Copy link

I can confirm that this is still a problem with AWS provider version 1.46.0

It's actually quite a dangerous bug if the target group it refers to no longer exists; It causes autoscaling to fail to replace instances as they are terminated. In my case, our test environment scales down at night and failed to scale back up in the morning. However, when autoscaling groups are used (as they are most commonly) for 24 hour high availability and self-healing, this self healing would fail to happen in the case of outage / spot price termination etc. This could happen months removed from the terraform change to the ASG.

@MichaelMure
Copy link

Can confirm the problem. The same way, lifecycle.ignore_changes seems to not be replicated either.

Terraform v0.11.11
provider.aws v1.54.0

@filiptepper
Copy link

Confirming this with the following versions.

Terraform v0.12.8
+ provider.aws v2.26.0

@anGie44
Copy link
Contributor

anGie44 commented Jul 14, 2020

The associated changes have been merged and will release with the upcoming v3.0.0 release of the Terraform AWS Provider.

@ghost
Copy link

ghost commented Jul 31, 2020

This has been released in version 3.0.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Aug 14, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service. service/elbv2 Issues and PRs that pertain to the elbv2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants