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

[aws_autoscaling_group] Attaching/Detaching a lot of loadbalancers fails #256

Closed
hashibot opened this issue Jun 13, 2017 · 8 comments · Fixed by #10435
Closed

[aws_autoscaling_group] Attaching/Detaching a lot of loadbalancers fails #256

hashibot opened this issue Jun 13, 2017 · 8 comments · Fixed by #10435
Assignees
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service.
Milestone

Comments

@hashibot
Copy link

This issue was originally opened by @freeman as hashicorp/terraform#8718. It was migrated here as part of the provider split. The original body of the issue is below.


Hello,

We heavily use modules in our terraform stacks.
When updating some core modules this resulted in massive updates to the load balancers attached to some of our autoscaling groups and we are getting this error:

* aws_autoscaling_group.web: [WARN] Error updating Load Balancers for AutoScaling Group (DEV-AS-XXX-WEB), error: ValidationError: Trying to update too many Load Balancers/Target Groups at once. The limit is 10
    status code: 400, request id: xxx3fc5c-751b-11e6-8d48-bf41d1251xxx

Terraform Version

Using terraform v0.7.3

Affected Resource(s)

  • aws_autoscaling_group

Expected Behavior

The update should have succeded

Actual Behavior

We got the error mentionned earlier

Steps to Reproduce

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

  1. Create an infrastructure with more than 10 load balancers attached to an autoscaling group
  2. terraform apply
  3. You will get the error mentionned

From looking at the source this happens here

According to Auto Scaling Limits this will also be an issue with target groups.

I guess the feature request is for terraform to proceed in batches of 10 modifications at a time.

@hashibot hashibot added the bug Addresses a defect in current functionality. label Jun 13, 2017
@cemo
Copy link

cemo commented Jan 15, 2018

Is there any workaround for this issue? :)

@radeksimko radeksimko added the service/autoscaling Issues and PRs that pertain to the autoscaling service. label Jan 25, 2018
@kladiv
Copy link

kladiv commented Jun 5, 2019

+1

@beezly
Copy link
Contributor

beezly commented Aug 28, 2019

This still exists in 2.17.0

bflad added a commit that referenced this issue Oct 10, 2019
… by 10 to prevent API and rate limiting errors

Reference: #256
Reference: #10435
Reference: https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_AttachLoadBalancers.html
Reference: https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DetachLoadBalancers.html

This change is complementary to the target group batching. The AutoScaling API for `AttachLoadBalancers` and `DetachLoadBalancers` only allow 10 elements at a time. In addition to the batching to split the API requests, we must wait for the batch to fully complete before moving onto the next batch, otherwise the API returns a rate limiting error:

```
--- FAIL: TestAccAWSAutoScalingGroup_LoadBalancers (360.22s)
    testing.go:569: Step 2 error: errors during apply:

        Error: Error updating Load Balancers for AutoScaling Group (tf-asg-2019101000090127270000000d), error: ValidationError: Trying to update too many Load Balancers/Target Groups at once. The limit is 10
```

Output from acceptance testing:

```
--- PASS: TestAccAWSAutoScalingGroup_LoadBalancers (443.84s)
```
@bflad
Copy link
Contributor

bflad commented Oct 10, 2019

Pull request for batching target_group_arns updates (thanks @beezly!): #10435
Pull request for batching load_balancers updates: #10445

@bflad bflad self-assigned this Oct 10, 2019
@bflad bflad added this to the v2.32.0 milestone Oct 10, 2019
@bflad
Copy link
Contributor

bflad commented Oct 10, 2019

The fix to batch large target_group_arns updates has been merged and will release with version 2.32.0 of the Terraform AWS Provider, later today. The fix to batch large load_balancers updates should land shortly, but potentially not in today's release. I'll post an update in this issue once that one is merged as well.

@ghost
Copy link

ghost commented Oct 10, 2019

This has been released in version 2.32.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!

@bflad
Copy link
Contributor

bflad commented Oct 31, 2019

Just to followup here, the similar change to load_balancers handling has been merged as well and will release with version 2.35.0 of the Terraform AWS Provider, next Thursday. 👍

@ghost
Copy link

ghost commented Nov 9, 2019

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 Nov 9, 2019
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants