-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
TF not handling aws_autoscaling_group load_balancers correctly #15032
Comments
Hi @darose, can give us some more information so that we can look into this?
|
same thing happens to us. Terraform v0.13.3
resource "aws_autoscaling_group" "default-a-k8s-eu-west-1" {
enabled_metrics = ["GroupDesiredCapacity", "GroupInServiceInstances", "GroupMaxSize", "GroupMinSize", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
launch_configuration = aws_launch_configuration.default-a-k8s-eu-west-1.id
max_size = 3
metrics_granularity = "1Minute"
min_size = 1
name = "default-a.k8s.eu-west-1"
vpc_zone_identifier = [aws_subnet.private-a-k8s-eu-west-1.id]
}
resource "aws_autoscaling_attachment" "exttg-NLB--029644a29e076535-default-a" {
alb_target_group_arn = "arn:aws:elasticloadbalancing:eu-west-1:072412346744:targetgroup/NLB/029644a29e076535"
autoscaling_group_name = aws_autoscaling_group.default-a-k8s-eu-west-1.id
} |
Hi @EladDolev, does the configuration above show the complete This is documented for the If you're not using both |
I wonder if the issue here is occurring as a result of using a separate "aws_autoscaling_attachment" section, rather than a "load_balancers = [...]" clause in the "aws_autoscaling_group" section? |
Hi @gdavison These are default configurations generated by Kops, but there's nothing special about them. |
Hi @darose and @EladDolev, I've managed to track this down. This is due to a change made in version 3.0 of the provider, and described at https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-3-upgrade#drift-detection-enabled-for-load_balancers-and-target_group_arns-arguments. It should be better documented on the resource page itself, and I'll take care of that. This will have to be addressed in Kops, and it looks like there are several issues open for it, including #9913 and #9891. For more reference, the issue #3265 describes the problem if |
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! |
This issue was originally opened by @darose as hashicorp/terraform#26125. It was migrated here as a result of the provider split. The original body of the issue is below.
TF is not handling aws_autoscaling_group load_balancers correctly. When I do a TF plan/apply, it does not recognize that the load balancers are attached to the ASG, and tries to delete them:
If I allow it to do so, and then run TF plan/apply again, it then tries to perform the attachment again:
Terraform Version
Terraform Configuration Files
Debug Output
Crash Output
Expected Behavior
Terraform should recognize that the load balancer attachments are valid and not try to remove them.
Actual Behavior
Terraform does not recognize that the load balancer attachments are valid, and so keeps alternating between adding and removing the attachments.
Steps to Reproduce
terraform apply
- tries to remove the ASG/load balancer attachment.terraform apply
- tries to re-create the ASG/load balancer attachment.Additional Context
References
The text was updated successfully, but these errors were encountered: