From a005a97213e7d3736cf16821a20c5b8540263f3d Mon Sep 17 00:00:00 2001 From: Jon Burgess Date: Mon, 12 Aug 2019 09:49:44 +1000 Subject: [PATCH] Allow creation of everlasting spot fleet requests According to the AWS API doc, if `valid until` is _not_ set, then the spot fleet request "remains until you cancel it". By having a 24 hr default, then this behaviour cannot be achieved using this terraform provider - so the default it removed. Some conversation about the default: https://github.com/terraform-providers/terraform-provider-aws/commit/5bafd4b7c9eca54d18a506e4b8c6119a4761b5d1#r34628957 The relevant AWS doc: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SpotFleetRequestConfigData.html --- aws/resource_aws_spot_fleet_request.go | 3 --- website/docs/r/spot_fleet_request.html.markdown | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/aws/resource_aws_spot_fleet_request.go b/aws/resource_aws_spot_fleet_request.go index 22f9380ecc1..4ee9e19183e 100644 --- a/aws/resource_aws_spot_fleet_request.go +++ b/aws/resource_aws_spot_fleet_request.go @@ -686,9 +686,6 @@ func resourceAwsSpotFleetRequestCreate(d *schema.ResourceData, meta interface{}) return err } spotFleetConfig.ValidUntil = aws.Time(valid_until) - } else { - valid_until := time.Now().Add(24 * time.Hour) - spotFleetConfig.ValidUntil = aws.Time(valid_until) } if v, ok := d.GetOk("load_balancers"); ok && v.(*schema.Set).Len() > 0 { diff --git a/website/docs/r/spot_fleet_request.html.markdown b/website/docs/r/spot_fleet_request.html.markdown index 14516c02f90..274a10046ba 100644 --- a/website/docs/r/spot_fleet_request.html.markdown +++ b/website/docs/r/spot_fleet_request.html.markdown @@ -123,7 +123,7 @@ across different markets and instance types. `terminate`. * `fleet_type` - (Optional) The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is `maintain`. -* `valid_until` - (Optional) The end date and time of the request, in UTC [RFC3339](https://tools.ietf.org/html/rfc3339#section-5.8) format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. Defaults to 24 hours. +* `valid_until` - (Optional) The end date and time of the request, in UTC [RFC3339](https://tools.ietf.org/html/rfc3339#section-5.8) format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. * `valid_from` - (Optional) The start date and time of the request, in UTC [RFC3339](https://tools.ietf.org/html/rfc3339#section-5.8) format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately. * `load_balancers` (Optional) A list of elastic load balancer names to add to the Spot fleet. * `target_group_arns` (Optional) A list of `aws_alb_target_group` ARNs, for use with Application Load Balancing.