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

Spot Fleet Launch Template Support #12732

Merged
merged 67 commits into from
Apr 28, 2020

Conversation

DrFaust92
Copy link
Collaborator

@DrFaust92 DrFaust92 commented Apr 8, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Replaces #4866
Closes #4267

Release note for CHANGELOG:

resource_aws_spot_fleet_request: add `launch_template_config` support

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSSpotFleetRequest_'
--- PASS: TestAccAWSSpotFleetRequest_basic (281.16s)
--- PASS: TestAccAWSSpotFleetRequest_tags (417.55s)
--- PASS: TestAccAWSSpotFleetRequest_associatePublicIpAddress (263.50s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplate (278.78s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateConflictLaunchSpecification (3.86s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateWithOverrides (271.12s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateToLaunchSpec (544.95s)
--- PASS: TestAccAWSSpotFleetRequest_launchSpecToLaunchTemplate (811.98s)
--- PASS: TestAccAWSSpotFleetRequest_fleetType (333.26s)
--- PASS: TestAccAWSSpotFleetRequest_iamInstanceProfileArn (309.88s)
--- PASS: TestAccAWSSpotFleetRequest_changePriceForcesNewRequest (483.73s)
--- PASS: TestAccAWSSpotFleetRequest_updateTargetCapacity (893.50s)
--- PASS: TestAccAWSSpotFleetRequest_updateExcessCapacityTerminationPolicy (602.37s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion (326.32s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList (351.75s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList (340.60s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz (351.36s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet (352.60s)
--- PASS: TestAccAWSSpotFleetRequest_overriddingSpotPrice (431.92s)
--- PASS: TestAccAWSSpotFleetRequest_withoutSpotPrice (290.77s)
--- PASS: TestAccAWSSpotFleetRequest_diversifiedAllocation (362.86s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstancePools (352.32s)
--- PASS: TestAccAWSSpotFleetRequest_withWeightedCapacity (371.93s)
--- PASS: TestAccAWSSpotFleetRequest_withEBSDisk (307.90s)
--- PASS: TestAccAWSSpotFleetRequest_LaunchSpecification_RootBlockDevice_KmsKeyId (177.76s)
--- PASS: TestAccAWSSpotFleetRequest_withTags (267.05s)
--- PASS: TestAccAWSSpotFleetRequest_placementTenancyAndGroup (103.40s)
--- PASS: TestAccAWSSpotFleetRequest_WithELBs (354.51s)
--- PASS: TestAccAWSSpotFleetRequest_WithTargetGroups (423.99s)
--- PASS: TestAccAWSSpotFleetRequest_LaunchSpecification_EbsBlockDevice_KmsKeyId (193.76s)
--- PASS: TestAccAWSSpotFleetRequest_disappears (327.77s)

@DrFaust92 DrFaust92 requested a review from a team April 8, 2020 18:49
@ghost ghost added size/XXL Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. needs-triage Waiting for first response or review from a maintainer. labels Apr 8, 2020
@DrFaust92 DrFaust92 changed the title [WIP]Spotfleet Launch Template and On-Demand Capacity Support [WIP]Spot Fleet Launch Template Support Apr 9, 2020
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. and removed size/XXL Managed by automation to categorize the size of a PR. labels Apr 9, 2020
@DrFaust92 DrFaust92 force-pushed the spot-fleet-launch-template branch 2 times, most recently from 8fd3e4d to b802b46 Compare April 9, 2020 12:48
@DrFaust92 DrFaust92 changed the title [WIP]Spot Fleet Launch Template Support Spot Fleet Launch Template Support Apr 9, 2020
@scalp42
Copy link
Contributor

scalp42 commented Apr 10, 2020

Thanks a lot for the PR!

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 24, 2020
@bflad bflad self-assigned this Apr 24, 2020
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.

Hey there, @DrFaust92 -- first of all, thank you so much for rebasing and tackling this. 🥇 This is a very complex implementation (no fault of your own) and this resource logic is pretty dated in some parts, so kudos for shimming this in here. I left some initial feedback below on things I noticed from a first pass of looking over the code. Please let me know if you have questions and ping me when this is ready for another review, I'll try to provide feedback cycles ASAP. Thanks again.

aws/resource_aws_spot_fleet_request.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request.go Outdated Show resolved Hide resolved
},
},
},
Set: hashLaunchTemplateOverrides,
Copy link
Contributor

Choose a reason for hiding this comment

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

Open question -- does this work without the Set function? We should prefer to omit it, unless the resource behaviors explicitly require it. 👍

aws/structure.go Outdated Show resolved Hide resolved
website/docs/r/spot_fleet_request.html.markdown Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request_test.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request.go Outdated Show resolved Hide resolved
@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Apr 24, 2020
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.

Shaping up nicely! This round is mostly just fixing up the Terraform state setting and test naming randomization. After this we should be just on little fixes to finalize it. 🎉

aws/resource_aws_spot_fleet_request.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request_test.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request_test.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request_test.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request_test.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request_test.go Outdated Show resolved Hide resolved
aws/resource_aws_spot_fleet_request.go Outdated Show resolved Hide resolved
@DrFaust92
Copy link
Collaborator Author

DrFaust92 commented Apr 24, 2020

@bflad , i addressed the changes and running some more tests and check regarding dropping the Set function. it did give me some trouble testing after dropping it but ill check again after the last changes

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Apr 24, 2020
@DrFaust92
Copy link
Collaborator Author

launch template tests are now passing

--- PASS: TestAccAWSSpotFleetRequest_launchTemplate (351.85s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateWithOverrides (320.83s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateToLaunchSpec (641.99s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplate_multiple (288.88s)

with the exclusion of TestAccAWSSpotFleetRequest_launchTemplateConflictLaunchSpecification
as the way to get this to fail changed, any idea on how to change the regex? or should this be dropped as it became a plan time validation check?

@DrFaust92 DrFaust92 requested a review from bflad April 24, 2020 17:49
@bflad
Copy link
Contributor

bflad commented Apr 28, 2020

with the exclusion of TestAccAWSSpotFleetRequest_launchTemplateConflictLaunchSpecification
as the way to get this to fail changed, any idea on how to change the regex? or should this be dropped as it became a plan time validation check?

We can skip it for now since its just validating plan-time behaviors that are tested in the Terraform Plugin SDK. For future reference when testing with ExpectError, you need to ensure the last TestStep has a valid configuration or the acceptance testing cannot destroy resources. See also: bflad/tfproviderlint#162

I'll drop it and merge this when CI passes after that, since I've verified the rest of the acceptance testing passes as expected. 👍

…leetRequest_launchTemplateConflictLaunchSpecification
@bflad bflad added this to the v2.60.0 milestone Apr 28, 2020
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 @DrFaust92 🚀

Output from acceptance testing:

--- PASS: TestAccAWSSpotFleetRequest_associatePublicIpAddress (416.10s)
--- PASS: TestAccAWSSpotFleetRequest_basic (346.62s)
--- PASS: TestAccAWSSpotFleetRequest_changePriceForcesNewRequest (612.73s)
--- PASS: TestAccAWSSpotFleetRequest_disappears (229.25s)
--- PASS: TestAccAWSSpotFleetRequest_diversifiedAllocation (351.50s)
--- PASS: TestAccAWSSpotFleetRequest_fleetType (286.87s)
--- PASS: TestAccAWSSpotFleetRequest_iamInstanceProfileArn (285.22s)
--- PASS: TestAccAWSSpotFleetRequest_instanceInterruptionBehavior (284.16s)
--- PASS: TestAccAWSSpotFleetRequest_LaunchSpecification_EbsBlockDevice_KmsKeyId (142.74s)
--- PASS: TestAccAWSSpotFleetRequest_LaunchSpecification_RootBlockDevice_KmsKeyId (145.99s)
--- PASS: TestAccAWSSpotFleetRequest_launchSpecToLaunchTemplate (540.97s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplate (284.34s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplate_multiple (213.22s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateToLaunchSpec (542.07s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateWithOverrides (216.46s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList (273.30s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion (345.74s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList (285.52s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstancePools (351.19s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz (337.09s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet (216.98s)
--- PASS: TestAccAWSSpotFleetRequest_overriddingSpotPrice (320.64s)
--- PASS: TestAccAWSSpotFleetRequest_placementTenancyAndGroup (63.07s)
--- PASS: TestAccAWSSpotFleetRequest_tags (354.51s)
--- PASS: TestAccAWSSpotFleetRequest_updateExcessCapacityTerminationPolicy (542.49s)
--- PASS: TestAccAWSSpotFleetRequest_updateTargetCapacity (828.53s)
--- PASS: TestAccAWSSpotFleetRequest_withEBSDisk (279.53s)
--- PASS: TestAccAWSSpotFleetRequest_WithELBs (268.50s)
--- PASS: TestAccAWSSpotFleetRequest_withoutSpotPrice (350.86s)
--- PASS: TestAccAWSSpotFleetRequest_withTags (282.52s)
--- PASS: TestAccAWSSpotFleetRequest_WithTargetGroups (410.53s)
--- PASS: TestAccAWSSpotFleetRequest_withWeightedCapacity (289.97s)

@bflad bflad merged commit 27e8bc9 into hashicorp:master Apr 28, 2020
bflad added a commit that referenced this pull request Apr 28, 2020
@ghost
Copy link

ghost commented May 1, 2020

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

adamdecaf pushed a commit to adamdecaf/terraform-provider-aws that referenced this pull request May 28, 2020
…2732)

Output from acceptance testing:

```
--- PASS: TestAccAWSSpotFleetRequest_associatePublicIpAddress (416.10s)
--- PASS: TestAccAWSSpotFleetRequest_basic (346.62s)
--- PASS: TestAccAWSSpotFleetRequest_changePriceForcesNewRequest (612.73s)
--- PASS: TestAccAWSSpotFleetRequest_disappears (229.25s)
--- PASS: TestAccAWSSpotFleetRequest_diversifiedAllocation (351.50s)
--- PASS: TestAccAWSSpotFleetRequest_fleetType (286.87s)
--- PASS: TestAccAWSSpotFleetRequest_iamInstanceProfileArn (285.22s)
--- PASS: TestAccAWSSpotFleetRequest_instanceInterruptionBehavior (284.16s)
--- PASS: TestAccAWSSpotFleetRequest_LaunchSpecification_EbsBlockDevice_KmsKeyId (142.74s)
--- PASS: TestAccAWSSpotFleetRequest_LaunchSpecification_RootBlockDevice_KmsKeyId (145.99s)
--- PASS: TestAccAWSSpotFleetRequest_launchSpecToLaunchTemplate (540.97s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplate (284.34s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplate_multiple (213.22s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateToLaunchSpec (542.07s)
--- PASS: TestAccAWSSpotFleetRequest_launchTemplateWithOverrides (216.46s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList (273.30s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion (345.74s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList (285.52s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstancePools (351.19s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz (337.09s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet (216.98s)
--- PASS: TestAccAWSSpotFleetRequest_overriddingSpotPrice (320.64s)
--- PASS: TestAccAWSSpotFleetRequest_placementTenancyAndGroup (63.07s)
--- PASS: TestAccAWSSpotFleetRequest_tags (354.51s)
--- PASS: TestAccAWSSpotFleetRequest_updateExcessCapacityTerminationPolicy (542.49s)
--- PASS: TestAccAWSSpotFleetRequest_updateTargetCapacity (828.53s)
--- PASS: TestAccAWSSpotFleetRequest_withEBSDisk (279.53s)
--- PASS: TestAccAWSSpotFleetRequest_WithELBs (268.50s)
--- PASS: TestAccAWSSpotFleetRequest_withoutSpotPrice (350.86s)
--- PASS: TestAccAWSSpotFleetRequest_withTags (282.52s)
--- PASS: TestAccAWSSpotFleetRequest_WithTargetGroups (410.53s)
--- PASS: TestAccAWSSpotFleetRequest_withWeightedCapacity (289.97s)
```
@ghost
Copy link

ghost commented May 28, 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 May 28, 2020
@DrFaust92 DrFaust92 deleted the spot-fleet-launch-template branch June 23, 2020 11:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for launch templates to aws_spot_fleet_request
4 participants