-
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
aws_autoscaling_group bug - fail to set OnDemandBaseCapacity value to zero #7368
Comments
…ance_distribution on_demand_base_capacity and spot_max_price argument zero values References: * #7368 * https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstancesDistribution.html * https://github.com/aws/aws-sdk-go/releases/tag/v1.17.5 The `mixed_instances_policy` configuration block `instance_distribution` configuration block `on_demand_base_capacity` argument was erroneously omitted from the API requests when configured to 0. This has been fixed. The `mixed_instances_policy` configuration block `instance_distribution` configuration block `spot_max_price` argument now allows unconfiguring the value via an empty string as of AWS Go SDK 1.17.5. This has been added and verified. Output from acceptance testing: ``` --- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (208.32s) --- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (380.94s) --- PASS: TestAccAWSAutoScalingGroup_autoGeneratedName (57.41s) --- PASS: TestAccAWSAutoScalingGroup_basic (277.63s) --- PASS: TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier (79.47s) --- PASS: TestAccAWSAutoScalingGroup_emptyAvailabilityZones (58.64s) --- PASS: TestAccAWSAutoScalingGroup_enablingMetrics (172.07s) --- PASS: TestAccAWSAutoScalingGroup_importBasic (237.78s) --- PASS: TestAccAWSAutoScalingGroup_initialLifecycleHook (694.88s) --- PASS: TestAccAWSAutoScalingGroup_launchTemplate (44.01s) --- PASS: TestAccAWSAutoScalingGroup_LaunchTemplate_IAMInstanceProfile (52.89s) --- PASS: TestAccAWSAutoScalingGroup_launchTemplate_update (142.34s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy (80.87s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandAllocationStrategy (83.04s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandBaseCapacity (113.14s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandPercentageAboveBaseCapacity (80.93s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotAllocationStrategy (141.63s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotInstancePools (114.38s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotMaxPrice (76.59s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_LaunchTemplateName (49.45s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_Version (80.60s) --- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType (78.31s) --- PASS: TestAccAWSAutoScalingGroup_namePrefix (56.71s) --- PASS: TestAccAWSAutoScalingGroup_serviceLinkedRoleARN (82.65s) --- PASS: TestAccAWSAutoScalingGroup_suspendingProcesses (211.74s) --- PASS: TestAccAWSAutoScalingGroup_tags (347.60s) --- PASS: TestAccAWSAutoScalingGroup_terminationPolicies (75.88s) --- PASS: TestAccAWSAutoScalingGroup_VpcUpdates (77.10s) --- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer (383.31s) --- PASS: TestAccAWSAutoScalingGroup_withMetrics (55.06s) --- PASS: TestAccAWSAutoScalingGroup_withPlacementGroup (142.28s) ```
Pull request submitted: #7821 |
The fix for this has been merged and will release with version 2.1.0 of the Terraform AWS Provider, likely in the next day or so. |
This has been released in version 2.1.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
Hi @bflad, I tested this in latest version (v2.2.0) and still have the same issue in the following scenario:
aws_autoscaling_group.asg: Modifying... (ID: ASG-spot-test20190320123311924800000003) Error: Error applying plan: 1 error(s) occurred:
I noticed that the issue happens when: Can you please re-open the issue? Thanks, |
Is your configuration different now than before? In the original report its showing this in the plan:
Which wouldn't have previously updated correctly before version 2.1.0 of the Terraform AWS Provider. Now however, your new output is not showing that update. Your |
The original scenario was indeed resolved in 2.1.0. However now it is still failing in another specific scenario where on_demand_base_capacity is originally equal to 1 (as well as the max_size) and both being changed to zero and at the same time the Launch Template version is also being changed. This failure does not happen if the value of on_demand_base_capacity and max_size are being changed from 2 to zero. |
I'm seeing a related issue with 2.6.0. I have something like this :
Originally, |
I am still having this issue with provider 2.19 whenever i set the setting it to anything > 1 works as expected --EDIT apparently ( from #7938 (comment) ) my problem was that i was trying to change an already created ASG ) |
I can confirm, we had to delete the ASG itself by hand to have Terraform correctly re-create it with the changes made to |
I can confirm this issue still exist with provider aws v2.62.0. |
looking into this more, it's seems this line here in the While this pattern has been used for other with this being said, we could remove the |
The fix for this has been merged and will release with version |
This has been released in version 2.66.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! |
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! |
Community Note
Terraform Version
Terraform v0.11.10
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
When setting ASG desired_capacity, max_size, min_size and on_demand_base_capacity from "2" to "0" I would expect this work.
Actual Behavior
Got the following output & error:
aws_autoscaling_group.asg: Modifying... (ID: ASG-spot-test20190128172151691300000003)
desired_capacity: "2" => "0"
max_size: "2" => "0"
min_size: "2" => "0"
mixed_instances_policy.0.instances_distribution.0.on_demand_base_capacity: "2" => "0"
wait_for_elb_capacity: "2" => "0"
Error: Error applying plan:
1 error(s) occurred:
aws_autoscaling_group.asg: 1 error(s) occurred:
aws_autoscaling_group.asg: Error updating Autoscaling group: ValidationError: Max bound, 0, must be greater than or equal to OnDemandBaseCapacity, 2.
status code: 400, request id: aa94c480-2321-11e9-b6ea-799c575c4fd5
Steps to Reproduce
terraform apply -var size=2
terraform apply -var size=0
Important Factoids
References
The text was updated successfully, but these errors were encountered: