hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.66k stars 9.03k forks source link

[Bug]: wait_for_capacity_timeout is ignored in aws_autoscaling_group in case of insufficient capacity #33665

Open AIByteSmith opened 10 months ago

AIByteSmith commented 10 months ago

Terraform Core Version

1.5.7

AWS Provider Version

5.18.1

Affected Resource(s)

aws_autoscaling_group

Expected Behavior

Apply should wait for wait_for_capacity_timeout amount of time before failing with an error.

Actual Behavior

Apply is almost immediately failing with an error. 1 minute instead of 10 minutes for example

Relevant Error/Panic Output Snippet

Error: waiting for Auto Scaling Group (<blah>) capacity satisfied: scaling activity (<blah>): Failed: We currently do not have sufficient g5.12xlarge capacity in the Availability Zone you requested (us-east-1b). Our system will be working on provisioning additional capacity. You can currently get g5.12xlarge capacity by not specifying an Availability Zone in your request or choosing us-east-1a, us-east-1c, us-east-1d, us-east-1f. Launching EC2 instance failed.
│ 
│   with aws_autoscaling_group.<blah>,
│   on ec2.tf line 179, in resource "aws_autoscaling_group" "<blah>":
│  179: resource "aws_autoscaling_group" "<blah>" {

Terraform Configuration Files

resource "aws_autoscaling_group" "my_asg" {
  name                      = "my_asg"
  desired_capacity          = 1
  launch_template {
    id      = aws_launch_template.model_launch_template.id
    version = aws_launch_template.model_launch_template.latest_version
  }
  max_size              = 1
  min_size              = 0
  vpc_zone_identifier   = data.aws_subnets.private.ids
}

resource "aws_launch_template" "model_launch_template" {
  image_id      = "/aws/service/ecs/optimized-ami/amazon-linux-2/gpu/recommended/image_id"
  instance_type = "g5.12xlarge"
  ebs_optimized = true

  user_data = base64encode(<<EOF
#!/bin/bash
echo "ECS_CLUSTER=${aws_ecs_cluster.my_asg.name}" >> /etc/ecs/ecs.config
EOF
  )
}

Steps to Reproduce

Debug Output

No response

Panic Output

No response

Important Factoids

I believe this bug was previously reported, but then fixed and closed. Maybe it has resurfaced? Old bug: https://github.com/hashicorp/terraform-provider-aws/issues/29753

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 10 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue