mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Merge pull request #3311 from caarlos0/allow-non-persistent-spot-requests
Allow non-persistent spot requests
This commit is contained in:
commit
1300f165b1
@ -36,6 +36,11 @@ func resourceAwsSpotInstanceRequest() *schema.Resource {
|
|||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
}
|
}
|
||||||
|
s["spot_type"] = &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Default: "persistent",
|
||||||
|
}
|
||||||
s["wait_for_fulfillment"] = &schema.Schema{
|
s["wait_for_fulfillment"] = &schema.Schema{
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
@ -69,10 +74,7 @@ func resourceAwsSpotInstanceRequestCreate(d *schema.ResourceData, meta interface
|
|||||||
|
|
||||||
spotOpts := &ec2.RequestSpotInstancesInput{
|
spotOpts := &ec2.RequestSpotInstancesInput{
|
||||||
SpotPrice: aws.String(d.Get("spot_price").(string)),
|
SpotPrice: aws.String(d.Get("spot_price").(string)),
|
||||||
|
Type: aws.String(d.Get("spot_type").(string)),
|
||||||
// We always set the type to "persistent", since the imperative-like
|
|
||||||
// behavior of "one-time" does not map well to TF's declarative domain.
|
|
||||||
Type: aws.String("persistent"),
|
|
||||||
|
|
||||||
// Though the AWS API supports creating spot instance requests for multiple
|
// Though the AWS API supports creating spot instance requests for multiple
|
||||||
// instances, for TF purposes we fix this to one instance per request.
|
// instances, for TF purposes we fix this to one instance per request.
|
||||||
|
@ -51,6 +51,9 @@ Spot Instance Requests support all the same arguments as
|
|||||||
* `wait_for_fulfillment` - (Optional; Default: false) If set, Terraform will
|
* `wait_for_fulfillment` - (Optional; Default: false) If set, Terraform will
|
||||||
wait for the Spot Request to be fulfilled, and will throw an error if the
|
wait for the Spot Request to be fulfilled, and will throw an error if the
|
||||||
timeout of 10m is reached.
|
timeout of 10m is reached.
|
||||||
|
* `spot_type` - (Optional; Default: "persistent") If set to "one-time", after
|
||||||
|
the instance is terminated, the spot request will be closed. Also, Terraform
|
||||||
|
can't manage one-time spot requests, just launch them.
|
||||||
|
|
||||||
## Attributes Reference
|
## Attributes Reference
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user