Terraform v0.11.13
+ provider.aws v2.3.0
provider "aws" {
region = "sa-east-1"
}
terraform {
backend "s3" {
bucket = "my-state-bucket"
key = "teste-ec2-marcus.tfstate"
region = "us-east-1"
dynamodb_table = "terraform_state_locking"
}
}
resource "aws_instance" "teste_ec2_marcus" {
ami = "ami-04a7ebb302d65e89c"
availability_zone = "sa-east-1b"
subnet_id = "subnet-xxxxx"
instance_type = "m5.large"
key_name = "my-key"
tags = {
Name = "teste-ec2-marcus"
}
}
https://gist.github.com/marcusrios/76f29baa380c53949d1c602f7411409c
Acquiring state lock. This may take a few moments...
aws_instance.teste_ec2_marcus: Refreshing state... (ID: i-08d1f93f0d955e529)
Releasing state lock. This may take a few moments...
Error: Error refreshing state: 1 error(s) occurred:
* aws_instance.teste_ec2_marcus: 1 error(s) occurred:
* aws_instance.teste_ec2_marcus: aws_instance.teste_ec2_marcus: InstanceCreditSpecification.NotSupported: The instance ID i-08d1f93f0d955e529 does not support T2/T3 Unlimited.
status code: 400, request id: b1135cdf-b119-4f45-800b-faac4d1b3a0e
Refresh instance state without errors.
It's looks like the terraform-provider-aws is trying to get information about cpu_credits for instances that doesn't have this atribute (e.g: m5-large). In this case the aws api throws an error InstanceCreditSpecification.NotSupported. See
terraform init && terraform apply
No.
I'm change the error message to InstanceCreditSpecification.NotSupported build a new binary and after that works as expected.
Maybe the AWS api change the error message from UnsupportedOperation to InstanceCreditSpecification.NotSupported?
I'm try to reproduce this behaviour in other region (in my case us-east-1) and I can't. For some reason works fine ๐ค
In us-east-1:
โ teste-ec2-marcus git:(master) โ aws ec2 describe-instances --region us-east-1 --instance-ids i-07750d8d0f97a89a5 | jq '.Reservations[].Instances[].InstanceType'
"m5.large"
โ teste-ec2-marcus git:(master) โ aws ec2 describe-instance-credit-specifications --region us-east-1 --instance-id i-07750d8d0f97a89a5
{
"InstanceCreditSpecifications": [
{
"InstanceId": "i-07750d8d0f97a89a5",
"CpuCredits": "standard"
}
]
}
In sa-east-1:
โ teste-ec2-marcus git:(master) โ aws ec2 describe-instances --region sa-east-1 --instance-ids i-00d15d464e3106224 | jq '.Reservations[].Instances[].InstanceType'
"m5.large"
โ teste-ec2-marcus git:(master) โ aws ec2 describe-instance-credit-specifications --region sa-east-1 --instance-id i-00d15d464e3106224
An error occurred (InstanceCreditSpecification.NotSupported) when calling the DescribeInstanceCreditSpecifications operation: The instance ID i-00d15d464e3106224 does not support T2/T3 Unlimited.
We are having this issue in sa-east-1 only as well (out of 10 regions we use). Started today best as we can tell.
I just tested a deployment in sa-east-1 and it looks like the error is no longer occurring. @marcusrios could you verify that you're no longer receiving an error?
My understanding is that this has been rolled back.
@richardboydii I tested again in sa-east-1 region and now it's working as expected. Thanks all!
It turns out we may still need to fix this behavior to prevent future problems. Pull request submitted to disable the call unless the instance type is T2/T3: https://github.com/terraform-providers/terraform-provider-aws/pull/8107
The DescribeInstanceCreditSpecifications API call will be removed from the aws_instance data source and resource for non T2/T3 instance families in version 2.4.0 of the Terraform AWS Provider, releasing later today.
The above change has been released in version 2.4.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
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!
Most helpful comment
I'm try to reproduce this behaviour in other region (in my case us-east-1) and I can't. For some reason works fine ๐ค
In us-east-1:
In sa-east-1: