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

r/launch_template: only set credit specification if t2 instance type #5190

Merged
merged 1 commit into from
Jul 17, 2018

Conversation

kl4w
Copy link
Contributor

@kl4w kl4w commented Jul 13, 2018

Fixes #5081

Changes proposed in this pull request:

  • only set credit specification if t2 instance type

Output from acceptance testing:

make testacc TEST=./aws TESTARGS='-run=TestAccAWSLaunchTemplate_'
gofmt -w $(find . -name '*.go' |grep -v vendor)
==> Checking that code complies with gofmt requirements...
go install
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSLaunchTemplate_ -timeout 120m
=== RUN   TestAccAWSLaunchTemplate_importBasic
--- PASS: TestAccAWSLaunchTemplate_importBasic (14.76s)
=== RUN   TestAccAWSLaunchTemplate_importData
--- PASS: TestAccAWSLaunchTemplate_importData (13.17s)
=== RUN   TestAccAWSLaunchTemplate_basic
--- PASS: TestAccAWSLaunchTemplate_basic (12.73s)
=== RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (16.34s)
=== RUN   TestAccAWSLaunchTemplate_data
--- PASS: TestAccAWSLaunchTemplate_data (12.05s)
=== RUN   TestAccAWSLaunchTemplate_update
--- PASS: TestAccAWSLaunchTemplate_update (23.42s)
=== RUN   TestAccAWSLaunchTemplate_tags
--- PASS: TestAccAWSLaunchTemplate_tags (23.39s)
=== RUN   TestAccAWSLaunchTemplate_nonBurstable
--- PASS: TestAccAWSLaunchTemplate_nonBurstable (11.40s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	127.287s

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Jul 13, 2018
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. labels Jul 16, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @kl4w! 🚀

8 tests passed (all tests)
=== RUN   TestAccAWSLaunchTemplate_nonBurstable
--- PASS: TestAccAWSLaunchTemplate_nonBurstable (7.11s)
=== RUN   TestAccAWSLaunchTemplate_data
--- PASS: TestAccAWSLaunchTemplate_data (7.31s)
=== RUN   TestAccAWSLaunchTemplate_basic
--- PASS: TestAccAWSLaunchTemplate_basic (7.38s)
=== RUN   TestAccAWSLaunchTemplate_importData
--- PASS: TestAccAWSLaunchTemplate_importData (7.98s)
=== RUN   TestAccAWSLaunchTemplate_importBasic
--- PASS: TestAccAWSLaunchTemplate_importBasic (8.12s)
=== RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (9.43s)
=== RUN   TestAccAWSLaunchTemplate_tags
--- PASS: TestAccAWSLaunchTemplate_tags (12.41s)
=== RUN   TestAccAWSLaunchTemplate_update
--- PASS: TestAccAWSLaunchTemplate_update (12.45s)

@@ -510,8 +511,10 @@ func resourceAwsLaunchTemplateRead(d *schema.ResourceData, meta interface{}) err
return err
}

if err := d.Set("credit_specification", getCreditSpecification(ltData.CreditSpecification)); err != nil {
return err
if strings.HasPrefix(aws.StringValue(ltData.InstanceType), "t2") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we should perform this conditional on read as it can potentially break modules expecting credit_specification for outputs (this will be less of a concern with Terraform 0.12). I'll try removing this on merge.

@bflad bflad added this to the v1.28.0 milestone Jul 17, 2018
@bflad bflad merged commit 7ae126c into hashicorp:master Jul 17, 2018
bflad added a commit that referenced this pull request Jul 17, 2018
@kl4w kl4w deleted the non-t2-credit-specification branch July 17, 2018 15:09
@Dombo
Copy link

Dombo commented Jul 17, 2018

@kl4w thanks for addressing this - I can remove so much grimey code from my deploy tooling now.

@bflad
Copy link
Contributor

bflad commented Jul 18, 2018

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

@ghost
Copy link

ghost commented Apr 4, 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 4, 2020
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. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resource aws_launchtemplate credit_specification type standard prevents non-t2 instance_types from launching
3 participants