-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 wait_for_fulfillment to spot_fleet_request #1241
Conversation
@radeksimko This PR is ready now. |
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 left you one more and one less important note. Other than that the code looks very good. Thanks for this taking the time to submit this PR!
@@ -653,6 +681,33 @@ func resourceAwsSpotFleetRequestStateRefreshFunc(d *schema.ResourceData, meta in | |||
} | |||
} | |||
|
|||
func resourceAwsSpotFleetRequestFulfillmentRefreshFunc(d *schema.ResourceData, meta interface{}) resource.StateRefreshFunc { |
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.
Just a nitpick but I feel the interface of this refresh function could be less greedy, i.e. it doesn't need all of the resource data nor all metadata. How about reducing it to something like this?
func resourceAwsSpotFleetRequestFulfillmentRefreshFunc(id string, conn *ec2.EC2)
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.
Sounds good to me. I just copied the whole function from above. Also I already thought about merging these two somehow since they look almost the same.
Pending: []string{"pending_fulfillment"}, | ||
Target: []string{"fulfilled"}, | ||
Refresh: resourceAwsSpotFleetRequestFulfillmentRefreshFunc(d, meta), | ||
Timeout: 10 * time.Minute, |
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.
The customizable timeout is currently ignored here - do you mind changing it to d.Timeout(schema.TimeoutCreate)
? 😉
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.
fixed
I fixed the remarks. The acceptance tests are still running on my machine. |
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.
The acceptance tests are still running on my machine.
My run just finished. I noticed 2 failures, but I believe they're either unrelated or can be addressed in a separate PR.
I'm specifically talking about
- aws_spot_fleet_request.foo: fleet still has (...) running instances
I believe these are intermittent.
Hmm ... I didn't had any failures in the run of my first commit.
|
Which confirms my theory of those failures being intermittent 😃 |
With the 0.1.4 version of the provider, anyone having the problem where this "wait_for_fulliment" is not persisted back into state? Hence every run of "terraform plan" will show
Even after "terraform apply" or "terraform refresh" ? |
I can confirm this issue. I tested it with the following template (in
|
@radeksimko Done: #1816 |
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! |
work-in-progress: There are still many tests to fix. Fixing them will take some time, since I am busy right now.
This adds the
wait_for_fulfillment
argument toaws_spot_fleet_request
. Also many of the acceptance test actually don't work, therefore I am fixing everything which doesn't require #1203 and which I am able to fix. The most code is copied fromaws_spot_instance_request
.Occured Issues:
m1.small
instances don't work, since they don't support HVM images:Repeated errors have occured processing the launch specification "m1.small, ami-d06a90b0, Linux/UNIX, us-west-2a". It will not be retried for at least 13 minutes. Error message: com.amazonaws.services.ec2.model.AmazonEC2Exception: Non-Windows instances with a virtualization type of 'hvm' are currently not supported for this instance type. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterCombination)
aws_spot_fleet_request
might get created beforeaws_iam_policy_attachment
, which caused permission issues.launch_specification
changed in some tests the hash changed, which was confusing and took some time to figure out.Progress so far:
TestAccAWSSpotFleetRequest_associatePublicIpAddress
TestAccAWSSpotFleetRequest_changePriceForcesNewRequest
TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion
TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList
wrong AMITestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList
TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz
TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet
TestAccAWSSpotFleetRequest_overriddingSpotPrice
TestAccAWSSpotFleetRequest_diversifiedAllocation
– worked out of the boxTestAccAWSSpotFleetRequest_withWeightedCapacity
– worked out of the boxTestAccAWSSpotFleetRequest_withEBSDisk
– requires emptykey_name
TestAccAWSSpotFleetRequest_placementTenancy
– This is hard to fix, since I get this error message regardless of which instance type I chose:Instance type m4.large is not supported for the tenancy value (dedicated)