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

[Enhancement]: Do no retry on InsufficientInstanceCapacity error when using aws_ec2_instance_state #37730

Closed
02bensch opened this issue May 28, 2024 · 6 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.

Comments

@02bensch
Copy link

Description

Current:
When using the aws_ec2_instance_state to start an existing aws_ìnstance, if there is no underlying capacity available for that instance type in the Availability Zone (InsufficientInstanceCapacity), it will retry until:
a) capacity becomes available - can be any amount of time between 1-50 minutes
b) it hits the default timeout of roughly 50 minutes

Proposed:
aws_ec2_instance_state should behave like aws_instance when starting the instance, and error out if there is no capacity in the AZ, just like #21293 implemented.
This makes the Terraform run much more uniform by failing immediately

Affected Resource(s) and/or Data Source(s)

  • aws_ec2_instance_state
  • aws_instance

Potential Terraform Configuration

data "aws_ami" "ubuntu" {
  most_recent = true

  filter {
    name   = "name"
    values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
  }

  filter {
    name   = "virtualization-type"
    values = ["hvm"]
  }

  owners = ["099720109477"] # Canonical
}

resource "aws_instance" "test" {
  ami           = data.aws_ami.ubuntu.id
  instance_type = "g5.4xlarge" # a typical instance type which has capacity shortages in eu-central-1 & eu-west-1
}

resource "aws_ec2_instance_state" "test" {
  instance_id = aws_instance.test.id
  state       = "running"
}

References

AWS Terraform resources:

Related:
#21293

Would you like to implement a fix?

No

@02bensch 02bensch added the enhancement Requests to existing resources that expand the functionality or scope. label May 28, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/ec2 Issues and PRs that pertain to the ec2 service. label May 28, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 28, 2024
@02bensch
Copy link
Author

Here are two examples of the current behaviour:

aws_ec2_instance_state.Workspace: Modifying... [id=i-xxx]
aws_ec2_instance_state.Workspace: Still modifying... [10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [14m0s elapsed]
aws_ec2_instance_state.Workspace: Modifications complete after 14m10s [id=i-xxx]
aws_ec2_instance_state.Workspace: Modifying... [id=i-xxx]
aws_ec2_instance_state.Workspace: Still modifying... [10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [1m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [2m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [3m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [4m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [5m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [6m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [7m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [8m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [9m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [10m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [11m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [12m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [13m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [14m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [14m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [14m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [14m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [14m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [14m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [15m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [15m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [15m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [15m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [15m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [15m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [16m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [16m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [16m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [16m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [16m40s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [16m50s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [17m0s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [17m10s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [17m20s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [17m30s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [17m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [17m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [18m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [18m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [18m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [18m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [18m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [18m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [19m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [19m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [19m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [19m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [19m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [19m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [20m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [20m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [20m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [20m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [20m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [20m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [21m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [21m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [21m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [21m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [21m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [21m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [22m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [22m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [22m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [22m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [22m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [22m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [23m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [23m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [23m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [23m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [23m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [23m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [24m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [24m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [24m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [24m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [24m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [24m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [25m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [25m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [25m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [25m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [25m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [25m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [26m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [26m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [26m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [26m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [26m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [26m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [27m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [27m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [27m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [27m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [27m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [27m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [28m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [28m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [28m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [28m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [28m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [28m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [29m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [29m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [29m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [29m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [29m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [29m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [30m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [30m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [30m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [30m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [30m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [30m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [31m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [31m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [31m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [31m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [31m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [31m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [32m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [32m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [32m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [32m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [32m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [32m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [33m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [33m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [33m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [33m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [33m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [33m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [34m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [34m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [34m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [34m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [34m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [34m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [35m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [35m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [35m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [35m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [35m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [35m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [36m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [36m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [36m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [36m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [36m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [36m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [37m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [37m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [37m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [37m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [37m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [37m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [38m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [38m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [38m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [38m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [38m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [38m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [39m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [39m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [39m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [39m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [39m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [39m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [40m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [40m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [40m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [40m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [40m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [40m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [41m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [41m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [41m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [41m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [41m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [41m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [42m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [42m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [42m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [42m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [42m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [42m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [43m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [43m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [43m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [43m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [43m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [43m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [44m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [44m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [44m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [44m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [44m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [44m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [45m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [45m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [45m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [45m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [45m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [45m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [46m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [46m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [46m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [46m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [46m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [46m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [47m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [47m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [47m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [47m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [47m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [47m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [48m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [48m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [48m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [48m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [48m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [48m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [49m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [49m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [49m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [49m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [49m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [49m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [50m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [50m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [50m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [50m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [50m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [50m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [51m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [51m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [51m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [51m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [51m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [51m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [52m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [52m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [52m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [52m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [52m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [52m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [53m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [53m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [53m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [53m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [53m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [53m51s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [54m1s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [54m11s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [54m21s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [54m31s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [54m41s elapsed]
aws_ec2_instance_state.Workspace: Still modifying... [54m51s elapsed]
aws_ec2_instance_state.Workspace: Modifications errored after 54m53s
Error: starting EC2 Instance (i-xxx): InsufficientInstanceCapacity: Insufficient capacity.
	status code: 500, request id: xxx

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label May 28, 2024
@02bensch
Copy link
Author

02bensch commented Jun 19, 2024

Potential solution might be adding another case in internal/service/ec2/service_package.go

func (p *servicePackage) CustomizeConn(ctx context.Context, conn *ec2_sdkv1.EC2) (*ec2_sdkv1.EC2, error) {
	conn.Handlers.Retry.PushBack(func(r *request_sdkv1.Request) {
		switch err := r.Error; r.Operation.Name {
		case "RunInstances":
			// `InsufficientInstanceCapacity` error has status code 500 and AWS SDK try retry this error by default.
			if tfawserr_sdkv1.ErrCodeEquals(err, errCodeInsufficientInstanceCapacity) {
				r.Retryable = aws_sdkv1.Bool(false)
			}
		// potential actions called in ec2_instance_state.go which may hit InsufficientInstanceCapacity
		case "StartInstances":
			// `InsufficientInstanceCapacity` error has status code 500 and AWS SDK try retry this error by default.
			if tfawserr_sdkv1.ErrCodeEquals(err, errCodeInsufficientInstanceCapacity) {
				r.Retryable = aws_sdkv1.Bool(false)
			}
		}
	})

	return conn, nil
}```

@02bensch
Copy link
Author

02bensch commented Jul 10, 2024

Should be solved by #37142
in the upcoming release.
Specifically, https://github.com/hashicorp/terraform-provider-aws/pull/37142/files#diff-0f9b852383f63781005725b2c499461b7c20d5e6758facec3c8e09956a971878R52 should handle all actions which may encounter InsufficientInstanceCapacity.

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

No branches or pull requests

2 participants