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

On first run, terraform provisioning of Amazon Linux 2 results in credit_specification.0.cpu_credits: "unlimited" and then fails to edit instance #5769

Closed
jdelaporte opened this issue Sep 4, 2018 · 4 comments · Fixed by #5805
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@jdelaporte
Copy link

Issue

I am very new to Terraform, but on my first attempt to provision (which succeeded) and then edit (which failed) a t3.micro instance, I ran into the following error. It appears as though the default cpu_credits "standard" setting was not set the first time the instance was created. For some reason, aws provisioned with this value set to "unlimited." Then, AWS refused to let me interact further with that instance via Terraform. I was able to reproduce with both Amazon Linux 2 AMI and Ubuntu 18.04 AMI. The correct value of "standard" seems to stick if I do not run terraform init, and seems to get lost (and gets set to "unlimited") when I do run terraform init.

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

$ terraform -v
Terraform v0.11.8

  • provider.aws v1.34.0

Affected Resource(s)

  • aws_XXXXX

Terraform Configuration Files

provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
resource "aws_instance" "terraform-test" {
ami = "${var.ami-amazon2-ohio}"
instance_type = "t3.micro"
}

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

https://gist.github.com/jdelaporte/4a1f31eb7a0f33b45aeddbaa1e8c79ba

Panic Output

Expected Behavior

 <!--- What should have happened? --->

credit_specification.0.cpu_credits: "standard" after first run.

Actual Behavior

  credit_specification.0.cpu_credits: "unlimited" after first run.

Steps to Reproduce

  1. Configure new aws provider.
  2. Provision a t3.micro instance in us-east-2 with AMI ami-05ea59e90e2c10a56 (amazon Linux2).
  3. terraform init
  4. terraform apply
  5. Read terraform.tfstate to see "credit_specification.0.cpu_credits": "unlimited",

Important Factoids

References

  • #0000
@bflad bflad added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. labels Sep 6, 2018
@bflad bflad added this to the v1.37.0 milestone Sep 18, 2018
@bflad
Copy link
Contributor

bflad commented Sep 18, 2018

The fix for this has been merged into master for the aws_instance resource and will release with version 1.37.0 of the AWS provider, likely tomorrow.

@bflad
Copy link
Contributor

bflad commented Sep 19, 2018

This has been released in version 1.37.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@jdelaporte
Copy link
Author

Awesome. Thanks to the Terraform team for a quick fix!

@ghost
Copy link

ghost commented Apr 3, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants