-
Notifications
You must be signed in to change notification settings - Fork 151
/
spotFleetRequest.go
769 lines (709 loc) · 36.6 KB
/
spotFleetRequest.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package ec2
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an EC2 Spot Fleet Request resource. This allows a fleet of Spot
// instances to be requested on the Spot market.
//
// ## Example Usage
// ### Using launch specifications
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ec2.NewSpotFleetRequest(ctx, "cheapCompute", &ec2.SpotFleetRequestArgs{
// IamFleetRole: pulumi.String("arn:aws:iam::12345678:role/spot-fleet"),
// SpotPrice: pulumi.String("0.03"),
// AllocationStrategy: pulumi.String("diversified"),
// TargetCapacity: pulumi.Int(6),
// ValidUntil: pulumi.String("2019-11-04T20:44:20Z"),
// LaunchSpecifications: ec2.SpotFleetRequestLaunchSpecificationArray{
// &ec2.SpotFleetRequestLaunchSpecificationArgs{
// InstanceType: pulumi.String("m4.10xlarge"),
// Ami: pulumi.String("ami-1234"),
// SpotPrice: pulumi.String("2.793"),
// PlacementTenancy: pulumi.String("dedicated"),
// IamInstanceProfileArn: pulumi.Any(aws_iam_instance_profile.Example.Arn),
// },
// &ec2.SpotFleetRequestLaunchSpecificationArgs{
// InstanceType: pulumi.String("m4.4xlarge"),
// Ami: pulumi.String("ami-5678"),
// KeyName: pulumi.String("my-key"),
// SpotPrice: pulumi.String("1.117"),
// IamInstanceProfileArn: pulumi.Any(aws_iam_instance_profile.Example.Arn),
// AvailabilityZone: pulumi.String("us-west-1a"),
// SubnetId: pulumi.String("subnet-1234"),
// WeightedCapacity: pulumi.String("35"),
// RootBlockDevices: ec2.SpotFleetRequestLaunchSpecificationRootBlockDeviceArray{
// &ec2.SpotFleetRequestLaunchSpecificationRootBlockDeviceArgs{
// VolumeSize: pulumi.Int(300),
// VolumeType: pulumi.String("gp2"),
// },
// },
// Tags: pulumi.StringMap{
// "Name": pulumi.String("spot-fleet-example"),
// },
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// ### Using launch templates
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// fooLaunchTemplate, err := ec2.NewLaunchTemplate(ctx, "fooLaunchTemplate", &ec2.LaunchTemplateArgs{
// ImageId: pulumi.String("ami-516b9131"),
// InstanceType: pulumi.String("m1.small"),
// KeyName: pulumi.String("some-key"),
// })
// if err != nil {
// return err
// }
// _, err = ec2.NewSpotFleetRequest(ctx, "fooSpotFleetRequest", &ec2.SpotFleetRequestArgs{
// IamFleetRole: pulumi.String("arn:aws:iam::12345678:role/spot-fleet"),
// SpotPrice: pulumi.String("0.005"),
// TargetCapacity: pulumi.Int(2),
// ValidUntil: pulumi.String("2019-11-04T20:44:20Z"),
// LaunchTemplateConfigs: ec2.SpotFleetRequestLaunchTemplateConfigArray{
// &ec2.SpotFleetRequestLaunchTemplateConfigArgs{
// LaunchTemplateSpecification: &ec2.SpotFleetRequestLaunchTemplateConfigLaunchTemplateSpecificationArgs{
// Id: fooLaunchTemplate.ID(),
// Version: fooLaunchTemplate.LatestVersion,
// },
// },
// },
// }, pulumi.DependsOn([]pulumi.Resource{
// aws_iam_policy_attachment.Test - attach,
// }))
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// > **NOTE:** This provider does not support the functionality where multiple `subnetId` or `availabilityZone` parameters can be specified in the same
// launch configuration block. If you want to specify multiple values, then separate launch configuration blocks should be used:
// ### Using multiple launch specifications
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ec2.NewSpotFleetRequest(ctx, "foo", &ec2.SpotFleetRequestArgs{
// IamFleetRole: pulumi.String("arn:aws:iam::12345678:role/spot-fleet"),
// LaunchSpecifications: ec2.SpotFleetRequestLaunchSpecificationArray{
// &ec2.SpotFleetRequestLaunchSpecificationArgs{
// Ami: pulumi.String("ami-d06a90b0"),
// AvailabilityZone: pulumi.String("us-west-2a"),
// InstanceType: pulumi.String("m1.small"),
// KeyName: pulumi.String("my-key"),
// },
// &ec2.SpotFleetRequestLaunchSpecificationArgs{
// Ami: pulumi.String("ami-d06a90b0"),
// AvailabilityZone: pulumi.String("us-west-2a"),
// InstanceType: pulumi.String("m5.large"),
// KeyName: pulumi.String("my-key"),
// },
// },
// SpotPrice: pulumi.String("0.005"),
// TargetCapacity: pulumi.Int(2),
// ValidUntil: pulumi.String("2019-11-04T20:44:20Z"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// ### Using multiple launch configurations
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ec2.GetSubnetIds(ctx, &ec2.GetSubnetIdsArgs{
// VpcId: _var.Vpc_id,
// }, nil)
// if err != nil {
// return err
// }
// fooLaunchTemplate, err := ec2.NewLaunchTemplate(ctx, "fooLaunchTemplate", &ec2.LaunchTemplateArgs{
// ImageId: pulumi.String("ami-516b9131"),
// InstanceType: pulumi.String("m1.small"),
// KeyName: pulumi.String("some-key"),
// })
// if err != nil {
// return err
// }
// _, err = ec2.NewSpotFleetRequest(ctx, "fooSpotFleetRequest", &ec2.SpotFleetRequestArgs{
// IamFleetRole: pulumi.String("arn:aws:iam::12345678:role/spot-fleet"),
// SpotPrice: pulumi.String("0.005"),
// TargetCapacity: pulumi.Int(2),
// ValidUntil: pulumi.String("2019-11-04T20:44:20Z"),
// LaunchTemplateConfigs: ec2.SpotFleetRequestLaunchTemplateConfigArray{
// &ec2.SpotFleetRequestLaunchTemplateConfigArgs{
// LaunchTemplateSpecification: &ec2.SpotFleetRequestLaunchTemplateConfigLaunchTemplateSpecificationArgs{
// Id: fooLaunchTemplate.ID(),
// Version: fooLaunchTemplate.LatestVersion,
// },
// Overrides: ec2.SpotFleetRequestLaunchTemplateConfigOverrideArray{
// &ec2.SpotFleetRequestLaunchTemplateConfigOverrideArgs{
// SubnetId: pulumi.Any(data.Aws_subnets.Example.Ids[0]),
// },
// &ec2.SpotFleetRequestLaunchTemplateConfigOverrideArgs{
// SubnetId: pulumi.Any(data.Aws_subnets.Example.Ids[1]),
// },
// &ec2.SpotFleetRequestLaunchTemplateConfigOverrideArgs{
// SubnetId: pulumi.Any(data.Aws_subnets.Example.Ids[2]),
// },
// },
// },
// },
// }, pulumi.DependsOn([]pulumi.Resource{
// aws_iam_policy_attachment.Test - attach,
// }))
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Spot Fleet Requests can be imported using `id`, e.g.
//
// ```sh
// $ pulumi import aws:ec2/spotFleetRequest:SpotFleetRequest fleet sfr-005e9ec8-5546-4c31-b317-31a62325411e
// ```
type SpotFleetRequest struct {
pulumi.CustomResourceState
// Indicates how to allocate the target capacity across
// the Spot pools specified by the Spot fleet request. The default is
// `lowestPrice`.
AllocationStrategy pulumi.StringPtrOutput `pulumi:"allocationStrategy"`
ClientToken pulumi.StringOutput `pulumi:"clientToken"`
// Indicates whether running Spot
// instances should be terminated if the target capacity of the Spot fleet
// request is decreased below the current size of the Spot fleet.
ExcessCapacityTerminationPolicy pulumi.StringPtrOutput `pulumi:"excessCapacityTerminationPolicy"`
// The type of fleet request. Indicates whether the Spot Fleet only requests the target
// capacity or also attempts to maintain it. Default is `maintain`.
FleetType pulumi.StringPtrOutput `pulumi:"fleetType"`
// Grants the Spot fleet permission to terminate
// Spot instances on your behalf when you cancel its Spot fleet request using
// CancelSpotFleetRequests or when the Spot fleet request expires, if you set
// terminateInstancesWithExpiration.
IamFleetRole pulumi.StringOutput `pulumi:"iamFleetRole"`
// Indicates whether a Spot
// instance stops or terminates when it is interrupted. Default is
// `terminate`.
InstanceInterruptionBehaviour pulumi.StringPtrOutput `pulumi:"instanceInterruptionBehaviour"`
// The number of Spot pools across which to allocate your target Spot capacity.
// Valid only when `allocationStrategy` is set to `lowestPrice`. Spot Fleet selects
// the cheapest Spot pools and evenly allocates your target Spot capacity across
// the number of Spot pools that you specify.
InstancePoolsToUseCount pulumi.IntPtrOutput `pulumi:"instancePoolsToUseCount"`
// Used to define the launch configuration of the
// spot-fleet request. Can be specified multiple times to define different bids
// across different markets and instance types. Conflicts with `launchTemplateConfig`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchSpecifications SpotFleetRequestLaunchSpecificationArrayOutput `pulumi:"launchSpecifications"`
// Launch template configuration block. See Launch Template Configs below for more details. Conflicts with `launchSpecification`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchTemplateConfigs SpotFleetRequestLaunchTemplateConfigArrayOutput `pulumi:"launchTemplateConfigs"`
// A list of elastic load balancer names to add to the Spot fleet.
LoadBalancers pulumi.StringArrayOutput `pulumi:"loadBalancers"`
// Indicates whether Spot fleet should replace unhealthy instances. Default `false`.
ReplaceUnhealthyInstances pulumi.BoolPtrOutput `pulumi:"replaceUnhealthyInstances"`
// Nested argument containing maintenance strategies for managing your Spot Instances that are at an elevated risk of being interrupted. Defined below.
SpotMaintenanceStrategies SpotFleetRequestSpotMaintenanceStrategiesPtrOutput `pulumi:"spotMaintenanceStrategies"`
// The maximum spot bid for this override request.
SpotPrice pulumi.StringPtrOutput `pulumi:"spotPrice"`
// The state of the Spot fleet request.
SpotRequestState pulumi.StringOutput `pulumi:"spotRequestState"`
// A map of tags to assign to the resource.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// The number of units to request. You can choose to set the
// target capacity in terms of instances or a performance characteristic that is
// important to your application workload, such as vCPUs, memory, or I/O.
TargetCapacity pulumi.IntOutput `pulumi:"targetCapacity"`
// A list of `alb.TargetGroup` ARNs, for use with Application Load Balancing.
TargetGroupArns pulumi.StringArrayOutput `pulumi:"targetGroupArns"`
// Indicates whether running Spot
// instances should be terminated when the Spot fleet request expires.
TerminateInstancesWithExpiration pulumi.BoolPtrOutput `pulumi:"terminateInstancesWithExpiration"`
// 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.
ValidFrom pulumi.StringPtrOutput `pulumi:"validFrom"`
// 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.
ValidUntil pulumi.StringPtrOutput `pulumi:"validUntil"`
// If set, this provider will
// wait for the Spot Request to be fulfilled, and will throw an error if the
// timeout of 10m is reached.
WaitForFulfillment pulumi.BoolPtrOutput `pulumi:"waitForFulfillment"`
}
// NewSpotFleetRequest registers a new resource with the given unique name, arguments, and options.
func NewSpotFleetRequest(ctx *pulumi.Context,
name string, args *SpotFleetRequestArgs, opts ...pulumi.ResourceOption) (*SpotFleetRequest, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.IamFleetRole == nil {
return nil, errors.New("invalid value for required argument 'IamFleetRole'")
}
if args.TargetCapacity == nil {
return nil, errors.New("invalid value for required argument 'TargetCapacity'")
}
var resource SpotFleetRequest
err := ctx.RegisterResource("aws:ec2/spotFleetRequest:SpotFleetRequest", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSpotFleetRequest gets an existing SpotFleetRequest resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetSpotFleetRequest(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SpotFleetRequestState, opts ...pulumi.ResourceOption) (*SpotFleetRequest, error) {
var resource SpotFleetRequest
err := ctx.ReadResource("aws:ec2/spotFleetRequest:SpotFleetRequest", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SpotFleetRequest resources.
type spotFleetRequestState struct {
// Indicates how to allocate the target capacity across
// the Spot pools specified by the Spot fleet request. The default is
// `lowestPrice`.
AllocationStrategy *string `pulumi:"allocationStrategy"`
ClientToken *string `pulumi:"clientToken"`
// Indicates whether running Spot
// instances should be terminated if the target capacity of the Spot fleet
// request is decreased below the current size of the Spot fleet.
ExcessCapacityTerminationPolicy *string `pulumi:"excessCapacityTerminationPolicy"`
// The type of fleet request. Indicates whether the Spot Fleet only requests the target
// capacity or also attempts to maintain it. Default is `maintain`.
FleetType *string `pulumi:"fleetType"`
// Grants the Spot fleet permission to terminate
// Spot instances on your behalf when you cancel its Spot fleet request using
// CancelSpotFleetRequests or when the Spot fleet request expires, if you set
// terminateInstancesWithExpiration.
IamFleetRole *string `pulumi:"iamFleetRole"`
// Indicates whether a Spot
// instance stops or terminates when it is interrupted. Default is
// `terminate`.
InstanceInterruptionBehaviour *string `pulumi:"instanceInterruptionBehaviour"`
// The number of Spot pools across which to allocate your target Spot capacity.
// Valid only when `allocationStrategy` is set to `lowestPrice`. Spot Fleet selects
// the cheapest Spot pools and evenly allocates your target Spot capacity across
// the number of Spot pools that you specify.
InstancePoolsToUseCount *int `pulumi:"instancePoolsToUseCount"`
// Used to define the launch configuration of the
// spot-fleet request. Can be specified multiple times to define different bids
// across different markets and instance types. Conflicts with `launchTemplateConfig`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchSpecifications []SpotFleetRequestLaunchSpecification `pulumi:"launchSpecifications"`
// Launch template configuration block. See Launch Template Configs below for more details. Conflicts with `launchSpecification`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchTemplateConfigs []SpotFleetRequestLaunchTemplateConfig `pulumi:"launchTemplateConfigs"`
// A list of elastic load balancer names to add to the Spot fleet.
LoadBalancers []string `pulumi:"loadBalancers"`
// Indicates whether Spot fleet should replace unhealthy instances. Default `false`.
ReplaceUnhealthyInstances *bool `pulumi:"replaceUnhealthyInstances"`
// Nested argument containing maintenance strategies for managing your Spot Instances that are at an elevated risk of being interrupted. Defined below.
SpotMaintenanceStrategies *SpotFleetRequestSpotMaintenanceStrategies `pulumi:"spotMaintenanceStrategies"`
// The maximum spot bid for this override request.
SpotPrice *string `pulumi:"spotPrice"`
// The state of the Spot fleet request.
SpotRequestState *string `pulumi:"spotRequestState"`
// A map of tags to assign to the resource.
Tags map[string]string `pulumi:"tags"`
// The number of units to request. You can choose to set the
// target capacity in terms of instances or a performance characteristic that is
// important to your application workload, such as vCPUs, memory, or I/O.
TargetCapacity *int `pulumi:"targetCapacity"`
// A list of `alb.TargetGroup` ARNs, for use with Application Load Balancing.
TargetGroupArns []string `pulumi:"targetGroupArns"`
// Indicates whether running Spot
// instances should be terminated when the Spot fleet request expires.
TerminateInstancesWithExpiration *bool `pulumi:"terminateInstancesWithExpiration"`
// 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.
ValidFrom *string `pulumi:"validFrom"`
// 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.
ValidUntil *string `pulumi:"validUntil"`
// If set, this provider will
// wait for the Spot Request to be fulfilled, and will throw an error if the
// timeout of 10m is reached.
WaitForFulfillment *bool `pulumi:"waitForFulfillment"`
}
type SpotFleetRequestState struct {
// Indicates how to allocate the target capacity across
// the Spot pools specified by the Spot fleet request. The default is
// `lowestPrice`.
AllocationStrategy pulumi.StringPtrInput
ClientToken pulumi.StringPtrInput
// Indicates whether running Spot
// instances should be terminated if the target capacity of the Spot fleet
// request is decreased below the current size of the Spot fleet.
ExcessCapacityTerminationPolicy pulumi.StringPtrInput
// The type of fleet request. Indicates whether the Spot Fleet only requests the target
// capacity or also attempts to maintain it. Default is `maintain`.
FleetType pulumi.StringPtrInput
// Grants the Spot fleet permission to terminate
// Spot instances on your behalf when you cancel its Spot fleet request using
// CancelSpotFleetRequests or when the Spot fleet request expires, if you set
// terminateInstancesWithExpiration.
IamFleetRole pulumi.StringPtrInput
// Indicates whether a Spot
// instance stops or terminates when it is interrupted. Default is
// `terminate`.
InstanceInterruptionBehaviour pulumi.StringPtrInput
// The number of Spot pools across which to allocate your target Spot capacity.
// Valid only when `allocationStrategy` is set to `lowestPrice`. Spot Fleet selects
// the cheapest Spot pools and evenly allocates your target Spot capacity across
// the number of Spot pools that you specify.
InstancePoolsToUseCount pulumi.IntPtrInput
// Used to define the launch configuration of the
// spot-fleet request. Can be specified multiple times to define different bids
// across different markets and instance types. Conflicts with `launchTemplateConfig`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchSpecifications SpotFleetRequestLaunchSpecificationArrayInput
// Launch template configuration block. See Launch Template Configs below for more details. Conflicts with `launchSpecification`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchTemplateConfigs SpotFleetRequestLaunchTemplateConfigArrayInput
// A list of elastic load balancer names to add to the Spot fleet.
LoadBalancers pulumi.StringArrayInput
// Indicates whether Spot fleet should replace unhealthy instances. Default `false`.
ReplaceUnhealthyInstances pulumi.BoolPtrInput
// Nested argument containing maintenance strategies for managing your Spot Instances that are at an elevated risk of being interrupted. Defined below.
SpotMaintenanceStrategies SpotFleetRequestSpotMaintenanceStrategiesPtrInput
// The maximum spot bid for this override request.
SpotPrice pulumi.StringPtrInput
// The state of the Spot fleet request.
SpotRequestState pulumi.StringPtrInput
// A map of tags to assign to the resource.
Tags pulumi.StringMapInput
// The number of units to request. You can choose to set the
// target capacity in terms of instances or a performance characteristic that is
// important to your application workload, such as vCPUs, memory, or I/O.
TargetCapacity pulumi.IntPtrInput
// A list of `alb.TargetGroup` ARNs, for use with Application Load Balancing.
TargetGroupArns pulumi.StringArrayInput
// Indicates whether running Spot
// instances should be terminated when the Spot fleet request expires.
TerminateInstancesWithExpiration pulumi.BoolPtrInput
// 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.
ValidFrom pulumi.StringPtrInput
// 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.
ValidUntil pulumi.StringPtrInput
// If set, this provider will
// wait for the Spot Request to be fulfilled, and will throw an error if the
// timeout of 10m is reached.
WaitForFulfillment pulumi.BoolPtrInput
}
func (SpotFleetRequestState) ElementType() reflect.Type {
return reflect.TypeOf((*spotFleetRequestState)(nil)).Elem()
}
type spotFleetRequestArgs struct {
// Indicates how to allocate the target capacity across
// the Spot pools specified by the Spot fleet request. The default is
// `lowestPrice`.
AllocationStrategy *string `pulumi:"allocationStrategy"`
// Indicates whether running Spot
// instances should be terminated if the target capacity of the Spot fleet
// request is decreased below the current size of the Spot fleet.
ExcessCapacityTerminationPolicy *string `pulumi:"excessCapacityTerminationPolicy"`
// The type of fleet request. Indicates whether the Spot Fleet only requests the target
// capacity or also attempts to maintain it. Default is `maintain`.
FleetType *string `pulumi:"fleetType"`
// Grants the Spot fleet permission to terminate
// Spot instances on your behalf when you cancel its Spot fleet request using
// CancelSpotFleetRequests or when the Spot fleet request expires, if you set
// terminateInstancesWithExpiration.
IamFleetRole string `pulumi:"iamFleetRole"`
// Indicates whether a Spot
// instance stops or terminates when it is interrupted. Default is
// `terminate`.
InstanceInterruptionBehaviour *string `pulumi:"instanceInterruptionBehaviour"`
// The number of Spot pools across which to allocate your target Spot capacity.
// Valid only when `allocationStrategy` is set to `lowestPrice`. Spot Fleet selects
// the cheapest Spot pools and evenly allocates your target Spot capacity across
// the number of Spot pools that you specify.
InstancePoolsToUseCount *int `pulumi:"instancePoolsToUseCount"`
// Used to define the launch configuration of the
// spot-fleet request. Can be specified multiple times to define different bids
// across different markets and instance types. Conflicts with `launchTemplateConfig`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchSpecifications []SpotFleetRequestLaunchSpecification `pulumi:"launchSpecifications"`
// Launch template configuration block. See Launch Template Configs below for more details. Conflicts with `launchSpecification`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchTemplateConfigs []SpotFleetRequestLaunchTemplateConfig `pulumi:"launchTemplateConfigs"`
// A list of elastic load balancer names to add to the Spot fleet.
LoadBalancers []string `pulumi:"loadBalancers"`
// Indicates whether Spot fleet should replace unhealthy instances. Default `false`.
ReplaceUnhealthyInstances *bool `pulumi:"replaceUnhealthyInstances"`
// Nested argument containing maintenance strategies for managing your Spot Instances that are at an elevated risk of being interrupted. Defined below.
SpotMaintenanceStrategies *SpotFleetRequestSpotMaintenanceStrategies `pulumi:"spotMaintenanceStrategies"`
// The maximum spot bid for this override request.
SpotPrice *string `pulumi:"spotPrice"`
// A map of tags to assign to the resource.
Tags map[string]string `pulumi:"tags"`
// The number of units to request. You can choose to set the
// target capacity in terms of instances or a performance characteristic that is
// important to your application workload, such as vCPUs, memory, or I/O.
TargetCapacity int `pulumi:"targetCapacity"`
// A list of `alb.TargetGroup` ARNs, for use with Application Load Balancing.
TargetGroupArns []string `pulumi:"targetGroupArns"`
// Indicates whether running Spot
// instances should be terminated when the Spot fleet request expires.
TerminateInstancesWithExpiration *bool `pulumi:"terminateInstancesWithExpiration"`
// 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.
ValidFrom *string `pulumi:"validFrom"`
// 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.
ValidUntil *string `pulumi:"validUntil"`
// If set, this provider will
// wait for the Spot Request to be fulfilled, and will throw an error if the
// timeout of 10m is reached.
WaitForFulfillment *bool `pulumi:"waitForFulfillment"`
}
// The set of arguments for constructing a SpotFleetRequest resource.
type SpotFleetRequestArgs struct {
// Indicates how to allocate the target capacity across
// the Spot pools specified by the Spot fleet request. The default is
// `lowestPrice`.
AllocationStrategy pulumi.StringPtrInput
// Indicates whether running Spot
// instances should be terminated if the target capacity of the Spot fleet
// request is decreased below the current size of the Spot fleet.
ExcessCapacityTerminationPolicy pulumi.StringPtrInput
// The type of fleet request. Indicates whether the Spot Fleet only requests the target
// capacity or also attempts to maintain it. Default is `maintain`.
FleetType pulumi.StringPtrInput
// Grants the Spot fleet permission to terminate
// Spot instances on your behalf when you cancel its Spot fleet request using
// CancelSpotFleetRequests or when the Spot fleet request expires, if you set
// terminateInstancesWithExpiration.
IamFleetRole pulumi.StringInput
// Indicates whether a Spot
// instance stops or terminates when it is interrupted. Default is
// `terminate`.
InstanceInterruptionBehaviour pulumi.StringPtrInput
// The number of Spot pools across which to allocate your target Spot capacity.
// Valid only when `allocationStrategy` is set to `lowestPrice`. Spot Fleet selects
// the cheapest Spot pools and evenly allocates your target Spot capacity across
// the number of Spot pools that you specify.
InstancePoolsToUseCount pulumi.IntPtrInput
// Used to define the launch configuration of the
// spot-fleet request. Can be specified multiple times to define different bids
// across different markets and instance types. Conflicts with `launchTemplateConfig`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchSpecifications SpotFleetRequestLaunchSpecificationArrayInput
// Launch template configuration block. See Launch Template Configs below for more details. Conflicts with `launchSpecification`. At least one of `launchSpecification` or `launchTemplateConfig` is required.
LaunchTemplateConfigs SpotFleetRequestLaunchTemplateConfigArrayInput
// A list of elastic load balancer names to add to the Spot fleet.
LoadBalancers pulumi.StringArrayInput
// Indicates whether Spot fleet should replace unhealthy instances. Default `false`.
ReplaceUnhealthyInstances pulumi.BoolPtrInput
// Nested argument containing maintenance strategies for managing your Spot Instances that are at an elevated risk of being interrupted. Defined below.
SpotMaintenanceStrategies SpotFleetRequestSpotMaintenanceStrategiesPtrInput
// The maximum spot bid for this override request.
SpotPrice pulumi.StringPtrInput
// A map of tags to assign to the resource.
Tags pulumi.StringMapInput
// The number of units to request. You can choose to set the
// target capacity in terms of instances or a performance characteristic that is
// important to your application workload, such as vCPUs, memory, or I/O.
TargetCapacity pulumi.IntInput
// A list of `alb.TargetGroup` ARNs, for use with Application Load Balancing.
TargetGroupArns pulumi.StringArrayInput
// Indicates whether running Spot
// instances should be terminated when the Spot fleet request expires.
TerminateInstancesWithExpiration pulumi.BoolPtrInput
// 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.
ValidFrom pulumi.StringPtrInput
// 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.
ValidUntil pulumi.StringPtrInput
// If set, this provider will
// wait for the Spot Request to be fulfilled, and will throw an error if the
// timeout of 10m is reached.
WaitForFulfillment pulumi.BoolPtrInput
}
func (SpotFleetRequestArgs) ElementType() reflect.Type {
return reflect.TypeOf((*spotFleetRequestArgs)(nil)).Elem()
}
type SpotFleetRequestInput interface {
pulumi.Input
ToSpotFleetRequestOutput() SpotFleetRequestOutput
ToSpotFleetRequestOutputWithContext(ctx context.Context) SpotFleetRequestOutput
}
func (*SpotFleetRequest) ElementType() reflect.Type {
return reflect.TypeOf((*SpotFleetRequest)(nil))
}
func (i *SpotFleetRequest) ToSpotFleetRequestOutput() SpotFleetRequestOutput {
return i.ToSpotFleetRequestOutputWithContext(context.Background())
}
func (i *SpotFleetRequest) ToSpotFleetRequestOutputWithContext(ctx context.Context) SpotFleetRequestOutput {
return pulumi.ToOutputWithContext(ctx, i).(SpotFleetRequestOutput)
}
func (i *SpotFleetRequest) ToSpotFleetRequestPtrOutput() SpotFleetRequestPtrOutput {
return i.ToSpotFleetRequestPtrOutputWithContext(context.Background())
}
func (i *SpotFleetRequest) ToSpotFleetRequestPtrOutputWithContext(ctx context.Context) SpotFleetRequestPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SpotFleetRequestPtrOutput)
}
type SpotFleetRequestPtrInput interface {
pulumi.Input
ToSpotFleetRequestPtrOutput() SpotFleetRequestPtrOutput
ToSpotFleetRequestPtrOutputWithContext(ctx context.Context) SpotFleetRequestPtrOutput
}
type spotFleetRequestPtrType SpotFleetRequestArgs
func (*spotFleetRequestPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**SpotFleetRequest)(nil))
}
func (i *spotFleetRequestPtrType) ToSpotFleetRequestPtrOutput() SpotFleetRequestPtrOutput {
return i.ToSpotFleetRequestPtrOutputWithContext(context.Background())
}
func (i *spotFleetRequestPtrType) ToSpotFleetRequestPtrOutputWithContext(ctx context.Context) SpotFleetRequestPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SpotFleetRequestPtrOutput)
}
// SpotFleetRequestArrayInput is an input type that accepts SpotFleetRequestArray and SpotFleetRequestArrayOutput values.
// You can construct a concrete instance of `SpotFleetRequestArrayInput` via:
//
// SpotFleetRequestArray{ SpotFleetRequestArgs{...} }
type SpotFleetRequestArrayInput interface {
pulumi.Input
ToSpotFleetRequestArrayOutput() SpotFleetRequestArrayOutput
ToSpotFleetRequestArrayOutputWithContext(context.Context) SpotFleetRequestArrayOutput
}
type SpotFleetRequestArray []SpotFleetRequestInput
func (SpotFleetRequestArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*SpotFleetRequest)(nil))
}
func (i SpotFleetRequestArray) ToSpotFleetRequestArrayOutput() SpotFleetRequestArrayOutput {
return i.ToSpotFleetRequestArrayOutputWithContext(context.Background())
}
func (i SpotFleetRequestArray) ToSpotFleetRequestArrayOutputWithContext(ctx context.Context) SpotFleetRequestArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SpotFleetRequestArrayOutput)
}
// SpotFleetRequestMapInput is an input type that accepts SpotFleetRequestMap and SpotFleetRequestMapOutput values.
// You can construct a concrete instance of `SpotFleetRequestMapInput` via:
//
// SpotFleetRequestMap{ "key": SpotFleetRequestArgs{...} }
type SpotFleetRequestMapInput interface {
pulumi.Input
ToSpotFleetRequestMapOutput() SpotFleetRequestMapOutput
ToSpotFleetRequestMapOutputWithContext(context.Context) SpotFleetRequestMapOutput
}
type SpotFleetRequestMap map[string]SpotFleetRequestInput
func (SpotFleetRequestMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*SpotFleetRequest)(nil))
}
func (i SpotFleetRequestMap) ToSpotFleetRequestMapOutput() SpotFleetRequestMapOutput {
return i.ToSpotFleetRequestMapOutputWithContext(context.Background())
}
func (i SpotFleetRequestMap) ToSpotFleetRequestMapOutputWithContext(ctx context.Context) SpotFleetRequestMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SpotFleetRequestMapOutput)
}
type SpotFleetRequestOutput struct {
*pulumi.OutputState
}
func (SpotFleetRequestOutput) ElementType() reflect.Type {
return reflect.TypeOf((*SpotFleetRequest)(nil))
}
func (o SpotFleetRequestOutput) ToSpotFleetRequestOutput() SpotFleetRequestOutput {
return o
}
func (o SpotFleetRequestOutput) ToSpotFleetRequestOutputWithContext(ctx context.Context) SpotFleetRequestOutput {
return o
}
func (o SpotFleetRequestOutput) ToSpotFleetRequestPtrOutput() SpotFleetRequestPtrOutput {
return o.ToSpotFleetRequestPtrOutputWithContext(context.Background())
}
func (o SpotFleetRequestOutput) ToSpotFleetRequestPtrOutputWithContext(ctx context.Context) SpotFleetRequestPtrOutput {
return o.ApplyT(func(v SpotFleetRequest) *SpotFleetRequest {
return &v
}).(SpotFleetRequestPtrOutput)
}
type SpotFleetRequestPtrOutput struct {
*pulumi.OutputState
}
func (SpotFleetRequestPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SpotFleetRequest)(nil))
}
func (o SpotFleetRequestPtrOutput) ToSpotFleetRequestPtrOutput() SpotFleetRequestPtrOutput {
return o
}
func (o SpotFleetRequestPtrOutput) ToSpotFleetRequestPtrOutputWithContext(ctx context.Context) SpotFleetRequestPtrOutput {
return o
}
type SpotFleetRequestArrayOutput struct{ *pulumi.OutputState }
func (SpotFleetRequestArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]SpotFleetRequest)(nil))
}
func (o SpotFleetRequestArrayOutput) ToSpotFleetRequestArrayOutput() SpotFleetRequestArrayOutput {
return o
}
func (o SpotFleetRequestArrayOutput) ToSpotFleetRequestArrayOutputWithContext(ctx context.Context) SpotFleetRequestArrayOutput {
return o
}
func (o SpotFleetRequestArrayOutput) Index(i pulumi.IntInput) SpotFleetRequestOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) SpotFleetRequest {
return vs[0].([]SpotFleetRequest)[vs[1].(int)]
}).(SpotFleetRequestOutput)
}
type SpotFleetRequestMapOutput struct{ *pulumi.OutputState }
func (SpotFleetRequestMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]SpotFleetRequest)(nil))
}
func (o SpotFleetRequestMapOutput) ToSpotFleetRequestMapOutput() SpotFleetRequestMapOutput {
return o
}
func (o SpotFleetRequestMapOutput) ToSpotFleetRequestMapOutputWithContext(ctx context.Context) SpotFleetRequestMapOutput {
return o
}
func (o SpotFleetRequestMapOutput) MapIndex(k pulumi.StringInput) SpotFleetRequestOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) SpotFleetRequest {
return vs[0].(map[string]SpotFleetRequest)[vs[1].(string)]
}).(SpotFleetRequestOutput)
}
func init() {
pulumi.RegisterOutputType(SpotFleetRequestOutput{})
pulumi.RegisterOutputType(SpotFleetRequestPtrOutput{})
pulumi.RegisterOutputType(SpotFleetRequestArrayOutput{})
pulumi.RegisterOutputType(SpotFleetRequestMapOutput{})
}