-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add instance_pools_to_use
parameter to aws_spot_fleet_request
#5955
Conversation
@bflad I've seen you used different name for this param in ec2_fleet. Should I update this PR with similar change? Any other comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zytek 👋 Thanks for submitting this!
Output from acceptance testing:
not run, please assist
How can we help? We generally prefer contributors to be able to run their own acceptance testing to not cause long change request and reply cycles. If you're unable to run the testing for some reason, another community member or a maintainer will likely need to finish up the pull request. Not a big deal, we will just want to know.
Should I update this PR with similar change?
We prefer to follow the API/SDK naming of attributes, but your current name is pretty close so I wouldn't necessarily consider that a blocking review item personally. It would be nice if it did include _count
though.
Any other comments?
Any chance you could submit an acceptance test so we can ensure this works as expected and prevent future regressions? Its generally easiest to copy-paste an existing test and test configuration (making necessary adjustments).
@@ -285,6 +285,12 @@ func resourceAwsSpotFleetRequest() *schema.Resource { | |||
Default: "lowestPrice", | |||
ForceNew: true, | |||
}, | |||
"instance_pools_to_use": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: The API names this instance_pools_to_use_count
so it might be nice to be consistent.
@@ -623,6 +629,13 @@ func resourceAwsSpotFleetRequestCreate(d *schema.ResourceData, meta interface{}) | |||
spotFleetConfig.AllocationStrategy = aws.String("lowestPrice") | |||
} | |||
|
|||
if v, ok := d.GetOk("instance_pools_to_use"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend checking against the default value and removing our error check here (letting the API return the appropriate error if necessary), e.g.
if v, ok := d.GetOk("instance_pools_to_use_count"); ok && v.(int) != 1 {
spotFleetConfig.InstancePoolsToUseCount = aws.Int64(int64(v.(int)))
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bflad could you elaborate on why you prefer to return errors from API rather than catch them earlier? I am not opposing it, just curious about the rationale.
Working on updating this PR, I see one acceptance test failing due to spot prices jump, not sure if I should alter test spec or ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you elaborate on why you prefer to return errors from API rather than catch them earlier? I am not opposing it, just curious about the rationale.
Unless we can generate plan
time errors (multi-attribute validation in Terraform is a can of worms at the moment), we prefer the API because:
- Upstream API logic may change
- Upstream API may remove the restriction
- Less code on our end
Which generally boils down to less maintenance burden in this project (someone updating the code then getting a release cut) and for operators (requiring everyone to update their provider). This is the same reasoning why we try to avoid things like EC2 instance type validation, it can be too fast of a moving target or provide little benefit for all the effort.
Working on updating this PR, I see one acceptance test failing due to spot prices jump, not sure if I should alter test spec or ignore it.
Is it this one? #6031 😄 You can ignore it or potentially look at the forward looking solution mentioned in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarification. Yeah, the PR you mentioned is the exact issue I got. ;-)
instance_pools_to_use
parameter to aws_spot_fleet_request
instance_pools_to_use
parameter to aws_spot_fleet_request
Added tests and addressed comments by @bflad Two test failures but not related. Output:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @zytek! 🚀
--- PASS: TestAccAWSSpotFleetRequest_placementTenancy (54.44s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList (269.68s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz (270.39s)
--- PASS: TestAccAWSSpotFleetRequest_withWeightedCapacity (270.87s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet (279.35s)
--- PASS: TestAccAWSSpotFleetRequest_diversifiedAllocation (279.46s)
--- PASS: TestAccAWSSpotFleetRequest_overriddingSpotPrice (279.53s)
--- PASS: TestAccAWSSpotFleetRequest_multipleInstancePools (279.70s)
--- PASS: TestAccAWSSpotFleetRequest_withoutSpotPrice (279.77s)
--- PASS: TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion (285.34s)
--- PASS: TestAccAWSSpotFleetRequest_withEBSDisk (289.03s)
--- PASS: TestAccAWSSpotFleetRequest_fleetType (289.22s)
--- PASS: TestAccAWSSpotFleetRequest_associatePublicIpAddress (289.27s)
--- PASS: TestAccAWSSpotFleetRequest_withTags (289.75s)
--- PASS: TestAccAWSSpotFleetRequest_instanceInterruptionBehavior (290.62s)
--- PASS: TestAccAWSSpotFleetRequest_iamInstanceProfileArn (292.59s)
--- PASS: TestAccAWSSpotFleetRequest_WithELBs (307.24s)
--- PASS: TestAccAWSSpotFleetRequest_WithTargetGroups (374.32s)
--- PASS: TestAccAWSSpotFleetRequest_changePriceForcesNewRequest (554.19s)
This has been released in version 1.39.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "aws" {
version = "~> 1.39.0"
}
# ... other configuration ... |
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! |
Fixes #5928
Changes proposed in this pull request:
instance_pools_to_use
parameter toaws_spot_fleet_request
resourceOutput from acceptance testing:
Please comment and review, this is my attempt at working with
terraform
code.