Terraform-provider-aws: Support t2.unlimited

Created on 30 Nov 2017  ·  13Comments  ·  Source: hashicorp/terraform-provider-aws

Amazon recently announced a new flag for t2 instances.

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html

Terraform Version

Terraform v0.11.0

Affected Resource(s)

  • aws_instance
enhancement servicec2

Most helpful comment

Support for the aws_instance resource credit_specification argument has been merged into master and will release with v1.16.0 of the AWS provider, likely mid next week. Support for the new aws_launch_template resource (also supporting credit_specification) was released in v1.15.0 of the AWS provider. 🎉

All 13 comments

This option should also be implemented on aws_launch_configuration. See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html#t2-auto-scaling-grp

The doc you have linked to says how to specify T2 unlimited using a launch-template (which is a brand new EC2 API construct) but it doesn't seem to be possible at all using launch-configurations (the thing that has been possible for years in the autoscaling API)

So to get T2 unlimited on autoscaled instances Terraform would need to support launch-templates, which has been requested in #2505

How about support on plain old standalone ec2 instances (not part of an autoscaling group)? Is it possible to get that as a first pass?

@kylelaverty Thanks!

Support for the aws_instance resource credit_specification argument has been merged into master and will release with v1.16.0 of the AWS provider, likely mid next week. Support for the new aws_launch_template resource (also supporting credit_specification) was released in v1.15.0 of the AWS provider. 🎉

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

@bflad I'm trying to make a module that supports t2.unlimited with a t2 class instance an also supports non t2 instances. Making the specfication of cpu_credits to standard on a non t2 class instance_type doesn't work. It seems right now to not be possible to have a module that creates an instance with t2.unlimited on when a t2 is requested and supports non t2 class instances. Error is
aws_instance.instance-rabbitmq.0: Error launching source instance: InstanceCreditSpecification.NotSupported: The m5.large instance type does not support T2 Unlimited.

It seems like this section needs to be filtered out if a non-t2 class instance is requested.

Example of the config section:
credit_specification {
cpu_credits = "${substr(upper(var.cluster_instance_type),0,2) == "T2" ? "unlimited" : "standard"}"
}

As per docs, To enable T2 unlimited using aws_instance resource of terraform we can do below things. (Correct me if i am wrong)

credit_specification {
cpu_credits = "unlimited"
}

But how to enable T2 unlimited using aws_launch_configuration resoure of terraform?

@jayudhandha Currently AWS does not support the unlimited flag for launch configurations so there is no way for terraform to implement this.

@jayudhandha - kylelaverty is correct in that AWS does not support T2.unlimited using Launch Configurations, however you can use Launch Templates instead. These were implemented in #2505 which is now merged and released. See https://www.terraform.io/docs/providers/aws/r/launch_template.html

@andyspiers Thanks!

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!

Was this page helpful?
0 / 5 - 0 ratings