I get this error:
Error: Error launching source instance: InsufficientInstanceCapacity: We currently do not have sufficient t3a.medium capacity in the Availability Zone you requested (eu-central-1c). Our system will be working on provisioning additional capacity. You can currently get t3a.medium capacity by not specifying an Availability Zone in your request or choosing eu-central-1a, eu-central-1b. status code: 500, request id: (redacted)
I did not specify an Availability Zone directly in packer-build.json. I did, however, specify a subnet_id, and that is automagically linked to one single Availability Zone.
provider "aws" {
region = "eu-central-1"
}
resource "aws_instance" "test-instance" {
key_name = "(redacted)"
subnet_id = "(redacted)"
ami = "(redacted)"
instance_type = "t3a.medium"
security_groups = [ "(redacted)" ]
associate_public_ip_address = "true"
disable_api_termination = "false"
monitoring = "false"
tags = {
Name = "test-instance"
}
}
Amazon documentation (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshooting-launch.html#troubleshooting-launch-capacity) says:
- Wait a few minutes and then submit your request again; capacity can shift frequently.
- Submit a new request with a reduced number of instances. For example, if you're making a single request to launch 15 instances, try making 3 requests for 5 instances, or 15 requests for 1 instance instead.
- If you're launching an instance, submit a new request without specifying an Availability Zone.
- If you're launching an instance, submit a new request using a different instance type (which you can resize at a later stage). For more information, see Changing the instance type.
- If you are launching instances into a cluster placement group, you can get an insufficient capacity error. For more information, see Placement group rules and limitations.
- Doesn't work,
eu-central-1cis out oft3a.mediumcapacity for at least 2 days already. - Is not applicable, I'm requesting only 1 instance.
- This is my question, I don't know how to tell Terraform how to do that.
- I don't want to do that, because I won't be able to change instance type soon, because of (1).
- Not applicable, not using a cluster placement group.
How do I tell Terraform to use any available subnet from a list of 3 subnets (each linked to their own Availability Zone), so that I no longer get an error? I have no preference (do not care) in which Availability Zone the instance runs.