/
flexTemplateJob.go
853 lines (774 loc) · 41.9 KB
/
flexTemplateJob.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
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package dataflow
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/dataflow"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := dataflow.NewFlexTemplateJob(ctx, "bigDataJob", &dataflow.FlexTemplateJobArgs{
// ContainerSpecGcsPath: pulumi.String("gs://my-bucket/templates/template.json"),
// Parameters: pulumi.Map{
// "inputSubscription": pulumi.Any("messages"),
// },
// }, pulumi.Provider(google_beta))
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ## Note on "destroy" / "apply"
//
// There are many types of Dataflow jobs. Some Dataflow jobs run constantly,
// getting new data from (e.g.) a GCS bucket, and outputting data continuously.
// Some jobs process a set amount of data then terminate. All jobs can fail while
// running due to programming errors or other issues. In this way, Dataflow jobs
// are different from most other provider / Google resources.
//
// The Dataflow resource is considered 'existing' while it is in a nonterminal
// state. If it reaches a terminal state (e.g. 'FAILED', 'COMPLETE',
// 'CANCELLED'), it will be recreated on the next 'apply'. This is as expected for
// jobs which run continuously, but may surprise users who use this resource for
// other kinds of Dataflow jobs.
//
// A Dataflow job which is 'destroyed' may be "cancelled" or "drained". If
// "cancelled", the job terminates - any data written remains where it is, but no
// new data will be processed. If "drained", no new data will enter the pipeline,
// but any data currently in the pipeline will finish being processed. The default
// is "cancelled", but if a user sets `onDelete` to `"drain"` in the
// configuration, you may experience a long wait for your `pulumi destroy` to
// complete.
//
// You can potentially short-circuit the wait by setting `skipWaitOnJobTermination`
// to `true`, but beware that unless you take active steps to ensure that the job
// `name` parameter changes between instances, the name will conflict and the launch
// of the new job will fail. One way to do this is with a
// randomId
// resource, for example:
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/dataflow"
// "github.com/pulumi/pulumi-random/sdk/v4/go/random"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// bigDataJobSubscriptionId := "projects/myproject/subscriptions/messages"
// if param := cfg.Get("bigDataJobSubscriptionId"); param != "" {
// bigDataJobSubscriptionId = param
// }
// _, err := random.NewRandomId(ctx, "bigDataJobNameSuffix", &random.RandomIdArgs{
// ByteLength: pulumi.Int(4),
// Keepers: pulumi.Map{
// "region": pulumi.Any(_var.Region),
// "subscription_id": pulumi.String(bigDataJobSubscriptionId),
// },
// })
// if err != nil {
// return err
// }
// _, err = dataflow.NewFlexTemplateJob(ctx, "bigDataJob", &dataflow.FlexTemplateJobArgs{
// Region: pulumi.Any(_var.Region),
// ContainerSpecGcsPath: pulumi.String("gs://my-bucket/templates/template.json"),
// SkipWaitOnJobTermination: pulumi.Bool(true),
// Parameters: pulumi.Map{
// "inputSubscription": pulumi.String(bigDataJobSubscriptionId),
// },
// }, pulumi.Provider(google_beta))
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// This resource does not support import.
type FlexTemplateJob struct {
pulumi.CustomResourceState
// List of experiments that should be used by the job. An example value is ["enable_stackdriver_agent_metrics"].
AdditionalExperiments pulumi.StringArrayOutput `pulumi:"additionalExperiments"`
// The algorithm to use for autoscaling
AutoscalingAlgorithm pulumi.StringPtrOutput `pulumi:"autoscalingAlgorithm"`
// The GCS path to the Dataflow job Flex
// Template.
//
// ***
ContainerSpecGcsPath pulumi.StringOutput `pulumi:"containerSpecGcsPath"`
// Indicates if the job should use the streaming engine feature.
EnableStreamingEngine pulumi.BoolPtrOutput `pulumi:"enableStreamingEngine"`
// The configuration for VM IPs. Options are "WORKER_IP_PUBLIC" or "WORKER_IP_PRIVATE".
IpConfiguration pulumi.StringPtrOutput `pulumi:"ipConfiguration"`
// The unique ID of this job.
JobId pulumi.StringOutput `pulumi:"jobId"`
// The name for the Cloud KMS key for the job. Key format is:
// projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY
KmsKeyName pulumi.StringPtrOutput `pulumi:"kmsKeyName"`
// User labels to be specified for the job. Keys and values
// should follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
// page. **Note**: This field is marked as deprecated as the API does not currently
// support adding labels.
// **NOTE**: Google-provided Dataflow templates often provide default labels
// that begin with `goog-dataflow-provided`. Unless explicitly set in config, these
// labels will be ignored to prevent diffs on re-apply.
Labels pulumi.MapOutput `pulumi:"labels"`
// The machine type to use for launching the job. The default is n1-standard-1.
LauncherMachineType pulumi.StringPtrOutput `pulumi:"launcherMachineType"`
// The machine type to use for the job.
MachineType pulumi.StringPtrOutput `pulumi:"machineType"`
// The maximum number of Google Compute Engine instances to be made available to your pipeline during execution, from 1 to
// 1000.
MaxWorkers pulumi.IntPtrOutput `pulumi:"maxWorkers"`
// A unique name for the resource, required by Dataflow.
Name pulumi.StringOutput `pulumi:"name"`
// The network to which VMs will be assigned. If it is not provided, "default" will be used.
Network pulumi.StringPtrOutput `pulumi:"network"`
// The initial number of Google Compute Engine instances for the job.
NumWorkers pulumi.IntPtrOutput `pulumi:"numWorkers"`
// One of "drain" or "cancel". Specifies behavior of
// deletion during `pulumi destroy`. See above note.
OnDelete pulumi.StringPtrOutput `pulumi:"onDelete"`
// Key/Value pairs to be passed to the Dataflow job (as
// used in the template). Additional [pipeline options](https://cloud.google.com/dataflow/docs/guides/specifying-exec-params#setting-other-cloud-dataflow-pipeline-options)
// such as `serviceAccount`, `workerMachineType`, etc can be specified here.
Parameters pulumi.MapOutput `pulumi:"parameters"`
// The project in which the resource belongs. If it is not
// provided, the provider project is used.
Project pulumi.StringOutput `pulumi:"project"`
// The region in which the created job should run.
Region pulumi.StringOutput `pulumi:"region"`
// Docker registry location of container image to use for the 'worker harness. Default is the container for the version of
// the SDK. Note this field is only valid for portable pipelines.
SdkContainerImage pulumi.StringPtrOutput `pulumi:"sdkContainerImage"`
// The Service Account email used to create the job.
ServiceAccountEmail pulumi.StringOutput `pulumi:"serviceAccountEmail"`
// If true, treat DRAINING and CANCELLING as terminal job states and do not wait for further changes before removing from
// terraform state and moving on. WARNING: this will lead to job name conflicts if you do not ensure that the job names are
// different, e.g. by embedding a release ID or by using a random_id.
SkipWaitOnJobTermination pulumi.BoolPtrOutput `pulumi:"skipWaitOnJobTermination"`
// The Cloud Storage path to use for staging files. Must be a valid Cloud Storage URL, beginning with gs://.
StagingLocation pulumi.StringOutput `pulumi:"stagingLocation"`
// The current state of the resource, selected from the [JobState enum](https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState)
State pulumi.StringOutput `pulumi:"state"`
// The subnetwork to which VMs will be assigned. Should be of the form "regions/REGION/subnetworks/SUBNETWORK".
Subnetwork pulumi.StringPtrOutput `pulumi:"subnetwork"`
// The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with gs://.
TempLocation pulumi.StringOutput `pulumi:"tempLocation"`
// Only applicable when updating a pipeline. Map of transform name prefixes of the job to be replaced with the
// corresponding name prefixes of the new job.
TransformNameMapping pulumi.MapOutput `pulumi:"transformNameMapping"`
// The type of this job, selected from the JobType enum.
Type pulumi.StringOutput `pulumi:"type"`
}
// NewFlexTemplateJob registers a new resource with the given unique name, arguments, and options.
func NewFlexTemplateJob(ctx *pulumi.Context,
name string, args *FlexTemplateJobArgs, opts ...pulumi.ResourceOption) (*FlexTemplateJob, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ContainerSpecGcsPath == nil {
return nil, errors.New("invalid value for required argument 'ContainerSpecGcsPath'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource FlexTemplateJob
err := ctx.RegisterResource("gcp:dataflow/flexTemplateJob:FlexTemplateJob", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetFlexTemplateJob gets an existing FlexTemplateJob 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 GetFlexTemplateJob(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *FlexTemplateJobState, opts ...pulumi.ResourceOption) (*FlexTemplateJob, error) {
var resource FlexTemplateJob
err := ctx.ReadResource("gcp:dataflow/flexTemplateJob:FlexTemplateJob", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering FlexTemplateJob resources.
type flexTemplateJobState struct {
// List of experiments that should be used by the job. An example value is ["enable_stackdriver_agent_metrics"].
AdditionalExperiments []string `pulumi:"additionalExperiments"`
// The algorithm to use for autoscaling
AutoscalingAlgorithm *string `pulumi:"autoscalingAlgorithm"`
// The GCS path to the Dataflow job Flex
// Template.
//
// ***
ContainerSpecGcsPath *string `pulumi:"containerSpecGcsPath"`
// Indicates if the job should use the streaming engine feature.
EnableStreamingEngine *bool `pulumi:"enableStreamingEngine"`
// The configuration for VM IPs. Options are "WORKER_IP_PUBLIC" or "WORKER_IP_PRIVATE".
IpConfiguration *string `pulumi:"ipConfiguration"`
// The unique ID of this job.
JobId *string `pulumi:"jobId"`
// The name for the Cloud KMS key for the job. Key format is:
// projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY
KmsKeyName *string `pulumi:"kmsKeyName"`
// User labels to be specified for the job. Keys and values
// should follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
// page. **Note**: This field is marked as deprecated as the API does not currently
// support adding labels.
// **NOTE**: Google-provided Dataflow templates often provide default labels
// that begin with `goog-dataflow-provided`. Unless explicitly set in config, these
// labels will be ignored to prevent diffs on re-apply.
Labels map[string]interface{} `pulumi:"labels"`
// The machine type to use for launching the job. The default is n1-standard-1.
LauncherMachineType *string `pulumi:"launcherMachineType"`
// The machine type to use for the job.
MachineType *string `pulumi:"machineType"`
// The maximum number of Google Compute Engine instances to be made available to your pipeline during execution, from 1 to
// 1000.
MaxWorkers *int `pulumi:"maxWorkers"`
// A unique name for the resource, required by Dataflow.
Name *string `pulumi:"name"`
// The network to which VMs will be assigned. If it is not provided, "default" will be used.
Network *string `pulumi:"network"`
// The initial number of Google Compute Engine instances for the job.
NumWorkers *int `pulumi:"numWorkers"`
// One of "drain" or "cancel". Specifies behavior of
// deletion during `pulumi destroy`. See above note.
OnDelete *string `pulumi:"onDelete"`
// Key/Value pairs to be passed to the Dataflow job (as
// used in the template). Additional [pipeline options](https://cloud.google.com/dataflow/docs/guides/specifying-exec-params#setting-other-cloud-dataflow-pipeline-options)
// such as `serviceAccount`, `workerMachineType`, etc can be specified here.
Parameters map[string]interface{} `pulumi:"parameters"`
// The project in which the resource belongs. If it is not
// provided, the provider project is used.
Project *string `pulumi:"project"`
// The region in which the created job should run.
Region *string `pulumi:"region"`
// Docker registry location of container image to use for the 'worker harness. Default is the container for the version of
// the SDK. Note this field is only valid for portable pipelines.
SdkContainerImage *string `pulumi:"sdkContainerImage"`
// The Service Account email used to create the job.
ServiceAccountEmail *string `pulumi:"serviceAccountEmail"`
// If true, treat DRAINING and CANCELLING as terminal job states and do not wait for further changes before removing from
// terraform state and moving on. WARNING: this will lead to job name conflicts if you do not ensure that the job names are
// different, e.g. by embedding a release ID or by using a random_id.
SkipWaitOnJobTermination *bool `pulumi:"skipWaitOnJobTermination"`
// The Cloud Storage path to use for staging files. Must be a valid Cloud Storage URL, beginning with gs://.
StagingLocation *string `pulumi:"stagingLocation"`
// The current state of the resource, selected from the [JobState enum](https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState)
State *string `pulumi:"state"`
// The subnetwork to which VMs will be assigned. Should be of the form "regions/REGION/subnetworks/SUBNETWORK".
Subnetwork *string `pulumi:"subnetwork"`
// The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with gs://.
TempLocation *string `pulumi:"tempLocation"`
// Only applicable when updating a pipeline. Map of transform name prefixes of the job to be replaced with the
// corresponding name prefixes of the new job.
TransformNameMapping map[string]interface{} `pulumi:"transformNameMapping"`
// The type of this job, selected from the JobType enum.
Type *string `pulumi:"type"`
}
type FlexTemplateJobState struct {
// List of experiments that should be used by the job. An example value is ["enable_stackdriver_agent_metrics"].
AdditionalExperiments pulumi.StringArrayInput
// The algorithm to use for autoscaling
AutoscalingAlgorithm pulumi.StringPtrInput
// The GCS path to the Dataflow job Flex
// Template.
//
// ***
ContainerSpecGcsPath pulumi.StringPtrInput
// Indicates if the job should use the streaming engine feature.
EnableStreamingEngine pulumi.BoolPtrInput
// The configuration for VM IPs. Options are "WORKER_IP_PUBLIC" or "WORKER_IP_PRIVATE".
IpConfiguration pulumi.StringPtrInput
// The unique ID of this job.
JobId pulumi.StringPtrInput
// The name for the Cloud KMS key for the job. Key format is:
// projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY
KmsKeyName pulumi.StringPtrInput
// User labels to be specified for the job. Keys and values
// should follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
// page. **Note**: This field is marked as deprecated as the API does not currently
// support adding labels.
// **NOTE**: Google-provided Dataflow templates often provide default labels
// that begin with `goog-dataflow-provided`. Unless explicitly set in config, these
// labels will be ignored to prevent diffs on re-apply.
Labels pulumi.MapInput
// The machine type to use for launching the job. The default is n1-standard-1.
LauncherMachineType pulumi.StringPtrInput
// The machine type to use for the job.
MachineType pulumi.StringPtrInput
// The maximum number of Google Compute Engine instances to be made available to your pipeline during execution, from 1 to
// 1000.
MaxWorkers pulumi.IntPtrInput
// A unique name for the resource, required by Dataflow.
Name pulumi.StringPtrInput
// The network to which VMs will be assigned. If it is not provided, "default" will be used.
Network pulumi.StringPtrInput
// The initial number of Google Compute Engine instances for the job.
NumWorkers pulumi.IntPtrInput
// One of "drain" or "cancel". Specifies behavior of
// deletion during `pulumi destroy`. See above note.
OnDelete pulumi.StringPtrInput
// Key/Value pairs to be passed to the Dataflow job (as
// used in the template). Additional [pipeline options](https://cloud.google.com/dataflow/docs/guides/specifying-exec-params#setting-other-cloud-dataflow-pipeline-options)
// such as `serviceAccount`, `workerMachineType`, etc can be specified here.
Parameters pulumi.MapInput
// The project in which the resource belongs. If it is not
// provided, the provider project is used.
Project pulumi.StringPtrInput
// The region in which the created job should run.
Region pulumi.StringPtrInput
// Docker registry location of container image to use for the 'worker harness. Default is the container for the version of
// the SDK. Note this field is only valid for portable pipelines.
SdkContainerImage pulumi.StringPtrInput
// The Service Account email used to create the job.
ServiceAccountEmail pulumi.StringPtrInput
// If true, treat DRAINING and CANCELLING as terminal job states and do not wait for further changes before removing from
// terraform state and moving on. WARNING: this will lead to job name conflicts if you do not ensure that the job names are
// different, e.g. by embedding a release ID or by using a random_id.
SkipWaitOnJobTermination pulumi.BoolPtrInput
// The Cloud Storage path to use for staging files. Must be a valid Cloud Storage URL, beginning with gs://.
StagingLocation pulumi.StringPtrInput
// The current state of the resource, selected from the [JobState enum](https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState)
State pulumi.StringPtrInput
// The subnetwork to which VMs will be assigned. Should be of the form "regions/REGION/subnetworks/SUBNETWORK".
Subnetwork pulumi.StringPtrInput
// The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with gs://.
TempLocation pulumi.StringPtrInput
// Only applicable when updating a pipeline. Map of transform name prefixes of the job to be replaced with the
// corresponding name prefixes of the new job.
TransformNameMapping pulumi.MapInput
// The type of this job, selected from the JobType enum.
Type pulumi.StringPtrInput
}
func (FlexTemplateJobState) ElementType() reflect.Type {
return reflect.TypeOf((*flexTemplateJobState)(nil)).Elem()
}
type flexTemplateJobArgs struct {
// List of experiments that should be used by the job. An example value is ["enable_stackdriver_agent_metrics"].
AdditionalExperiments []string `pulumi:"additionalExperiments"`
// The algorithm to use for autoscaling
AutoscalingAlgorithm *string `pulumi:"autoscalingAlgorithm"`
// The GCS path to the Dataflow job Flex
// Template.
//
// ***
ContainerSpecGcsPath string `pulumi:"containerSpecGcsPath"`
// Indicates if the job should use the streaming engine feature.
EnableStreamingEngine *bool `pulumi:"enableStreamingEngine"`
// The configuration for VM IPs. Options are "WORKER_IP_PUBLIC" or "WORKER_IP_PRIVATE".
IpConfiguration *string `pulumi:"ipConfiguration"`
// The name for the Cloud KMS key for the job. Key format is:
// projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY
KmsKeyName *string `pulumi:"kmsKeyName"`
// User labels to be specified for the job. Keys and values
// should follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
// page. **Note**: This field is marked as deprecated as the API does not currently
// support adding labels.
// **NOTE**: Google-provided Dataflow templates often provide default labels
// that begin with `goog-dataflow-provided`. Unless explicitly set in config, these
// labels will be ignored to prevent diffs on re-apply.
Labels map[string]interface{} `pulumi:"labels"`
// The machine type to use for launching the job. The default is n1-standard-1.
LauncherMachineType *string `pulumi:"launcherMachineType"`
// The machine type to use for the job.
MachineType *string `pulumi:"machineType"`
// The maximum number of Google Compute Engine instances to be made available to your pipeline during execution, from 1 to
// 1000.
MaxWorkers *int `pulumi:"maxWorkers"`
// A unique name for the resource, required by Dataflow.
Name *string `pulumi:"name"`
// The network to which VMs will be assigned. If it is not provided, "default" will be used.
Network *string `pulumi:"network"`
// The initial number of Google Compute Engine instances for the job.
NumWorkers *int `pulumi:"numWorkers"`
// One of "drain" or "cancel". Specifies behavior of
// deletion during `pulumi destroy`. See above note.
OnDelete *string `pulumi:"onDelete"`
// Key/Value pairs to be passed to the Dataflow job (as
// used in the template). Additional [pipeline options](https://cloud.google.com/dataflow/docs/guides/specifying-exec-params#setting-other-cloud-dataflow-pipeline-options)
// such as `serviceAccount`, `workerMachineType`, etc can be specified here.
Parameters map[string]interface{} `pulumi:"parameters"`
// The project in which the resource belongs. If it is not
// provided, the provider project is used.
Project *string `pulumi:"project"`
// The region in which the created job should run.
Region *string `pulumi:"region"`
// Docker registry location of container image to use for the 'worker harness. Default is the container for the version of
// the SDK. Note this field is only valid for portable pipelines.
SdkContainerImage *string `pulumi:"sdkContainerImage"`
// The Service Account email used to create the job.
ServiceAccountEmail *string `pulumi:"serviceAccountEmail"`
// If true, treat DRAINING and CANCELLING as terminal job states and do not wait for further changes before removing from
// terraform state and moving on. WARNING: this will lead to job name conflicts if you do not ensure that the job names are
// different, e.g. by embedding a release ID or by using a random_id.
SkipWaitOnJobTermination *bool `pulumi:"skipWaitOnJobTermination"`
// The Cloud Storage path to use for staging files. Must be a valid Cloud Storage URL, beginning with gs://.
StagingLocation *string `pulumi:"stagingLocation"`
// The subnetwork to which VMs will be assigned. Should be of the form "regions/REGION/subnetworks/SUBNETWORK".
Subnetwork *string `pulumi:"subnetwork"`
// The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with gs://.
TempLocation *string `pulumi:"tempLocation"`
// Only applicable when updating a pipeline. Map of transform name prefixes of the job to be replaced with the
// corresponding name prefixes of the new job.
TransformNameMapping map[string]interface{} `pulumi:"transformNameMapping"`
}
// The set of arguments for constructing a FlexTemplateJob resource.
type FlexTemplateJobArgs struct {
// List of experiments that should be used by the job. An example value is ["enable_stackdriver_agent_metrics"].
AdditionalExperiments pulumi.StringArrayInput
// The algorithm to use for autoscaling
AutoscalingAlgorithm pulumi.StringPtrInput
// The GCS path to the Dataflow job Flex
// Template.
//
// ***
ContainerSpecGcsPath pulumi.StringInput
// Indicates if the job should use the streaming engine feature.
EnableStreamingEngine pulumi.BoolPtrInput
// The configuration for VM IPs. Options are "WORKER_IP_PUBLIC" or "WORKER_IP_PRIVATE".
IpConfiguration pulumi.StringPtrInput
// The name for the Cloud KMS key for the job. Key format is:
// projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY
KmsKeyName pulumi.StringPtrInput
// User labels to be specified for the job. Keys and values
// should follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
// page. **Note**: This field is marked as deprecated as the API does not currently
// support adding labels.
// **NOTE**: Google-provided Dataflow templates often provide default labels
// that begin with `goog-dataflow-provided`. Unless explicitly set in config, these
// labels will be ignored to prevent diffs on re-apply.
Labels pulumi.MapInput
// The machine type to use for launching the job. The default is n1-standard-1.
LauncherMachineType pulumi.StringPtrInput
// The machine type to use for the job.
MachineType pulumi.StringPtrInput
// The maximum number of Google Compute Engine instances to be made available to your pipeline during execution, from 1 to
// 1000.
MaxWorkers pulumi.IntPtrInput
// A unique name for the resource, required by Dataflow.
Name pulumi.StringPtrInput
// The network to which VMs will be assigned. If it is not provided, "default" will be used.
Network pulumi.StringPtrInput
// The initial number of Google Compute Engine instances for the job.
NumWorkers pulumi.IntPtrInput
// One of "drain" or "cancel". Specifies behavior of
// deletion during `pulumi destroy`. See above note.
OnDelete pulumi.StringPtrInput
// Key/Value pairs to be passed to the Dataflow job (as
// used in the template). Additional [pipeline options](https://cloud.google.com/dataflow/docs/guides/specifying-exec-params#setting-other-cloud-dataflow-pipeline-options)
// such as `serviceAccount`, `workerMachineType`, etc can be specified here.
Parameters pulumi.MapInput
// The project in which the resource belongs. If it is not
// provided, the provider project is used.
Project pulumi.StringPtrInput
// The region in which the created job should run.
Region pulumi.StringPtrInput
// Docker registry location of container image to use for the 'worker harness. Default is the container for the version of
// the SDK. Note this field is only valid for portable pipelines.
SdkContainerImage pulumi.StringPtrInput
// The Service Account email used to create the job.
ServiceAccountEmail pulumi.StringPtrInput
// If true, treat DRAINING and CANCELLING as terminal job states and do not wait for further changes before removing from
// terraform state and moving on. WARNING: this will lead to job name conflicts if you do not ensure that the job names are
// different, e.g. by embedding a release ID or by using a random_id.
SkipWaitOnJobTermination pulumi.BoolPtrInput
// The Cloud Storage path to use for staging files. Must be a valid Cloud Storage URL, beginning with gs://.
StagingLocation pulumi.StringPtrInput
// The subnetwork to which VMs will be assigned. Should be of the form "regions/REGION/subnetworks/SUBNETWORK".
Subnetwork pulumi.StringPtrInput
// The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with gs://.
TempLocation pulumi.StringPtrInput
// Only applicable when updating a pipeline. Map of transform name prefixes of the job to be replaced with the
// corresponding name prefixes of the new job.
TransformNameMapping pulumi.MapInput
}
func (FlexTemplateJobArgs) ElementType() reflect.Type {
return reflect.TypeOf((*flexTemplateJobArgs)(nil)).Elem()
}
type FlexTemplateJobInput interface {
pulumi.Input
ToFlexTemplateJobOutput() FlexTemplateJobOutput
ToFlexTemplateJobOutputWithContext(ctx context.Context) FlexTemplateJobOutput
}
func (*FlexTemplateJob) ElementType() reflect.Type {
return reflect.TypeOf((**FlexTemplateJob)(nil)).Elem()
}
func (i *FlexTemplateJob) ToFlexTemplateJobOutput() FlexTemplateJobOutput {
return i.ToFlexTemplateJobOutputWithContext(context.Background())
}
func (i *FlexTemplateJob) ToFlexTemplateJobOutputWithContext(ctx context.Context) FlexTemplateJobOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlexTemplateJobOutput)
}
func (i *FlexTemplateJob) ToOutput(ctx context.Context) pulumix.Output[*FlexTemplateJob] {
return pulumix.Output[*FlexTemplateJob]{
OutputState: i.ToFlexTemplateJobOutputWithContext(ctx).OutputState,
}
}
// FlexTemplateJobArrayInput is an input type that accepts FlexTemplateJobArray and FlexTemplateJobArrayOutput values.
// You can construct a concrete instance of `FlexTemplateJobArrayInput` via:
//
// FlexTemplateJobArray{ FlexTemplateJobArgs{...} }
type FlexTemplateJobArrayInput interface {
pulumi.Input
ToFlexTemplateJobArrayOutput() FlexTemplateJobArrayOutput
ToFlexTemplateJobArrayOutputWithContext(context.Context) FlexTemplateJobArrayOutput
}
type FlexTemplateJobArray []FlexTemplateJobInput
func (FlexTemplateJobArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*FlexTemplateJob)(nil)).Elem()
}
func (i FlexTemplateJobArray) ToFlexTemplateJobArrayOutput() FlexTemplateJobArrayOutput {
return i.ToFlexTemplateJobArrayOutputWithContext(context.Background())
}
func (i FlexTemplateJobArray) ToFlexTemplateJobArrayOutputWithContext(ctx context.Context) FlexTemplateJobArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlexTemplateJobArrayOutput)
}
func (i FlexTemplateJobArray) ToOutput(ctx context.Context) pulumix.Output[[]*FlexTemplateJob] {
return pulumix.Output[[]*FlexTemplateJob]{
OutputState: i.ToFlexTemplateJobArrayOutputWithContext(ctx).OutputState,
}
}
// FlexTemplateJobMapInput is an input type that accepts FlexTemplateJobMap and FlexTemplateJobMapOutput values.
// You can construct a concrete instance of `FlexTemplateJobMapInput` via:
//
// FlexTemplateJobMap{ "key": FlexTemplateJobArgs{...} }
type FlexTemplateJobMapInput interface {
pulumi.Input
ToFlexTemplateJobMapOutput() FlexTemplateJobMapOutput
ToFlexTemplateJobMapOutputWithContext(context.Context) FlexTemplateJobMapOutput
}
type FlexTemplateJobMap map[string]FlexTemplateJobInput
func (FlexTemplateJobMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*FlexTemplateJob)(nil)).Elem()
}
func (i FlexTemplateJobMap) ToFlexTemplateJobMapOutput() FlexTemplateJobMapOutput {
return i.ToFlexTemplateJobMapOutputWithContext(context.Background())
}
func (i FlexTemplateJobMap) ToFlexTemplateJobMapOutputWithContext(ctx context.Context) FlexTemplateJobMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(FlexTemplateJobMapOutput)
}
func (i FlexTemplateJobMap) ToOutput(ctx context.Context) pulumix.Output[map[string]*FlexTemplateJob] {
return pulumix.Output[map[string]*FlexTemplateJob]{
OutputState: i.ToFlexTemplateJobMapOutputWithContext(ctx).OutputState,
}
}
type FlexTemplateJobOutput struct{ *pulumi.OutputState }
func (FlexTemplateJobOutput) ElementType() reflect.Type {
return reflect.TypeOf((**FlexTemplateJob)(nil)).Elem()
}
func (o FlexTemplateJobOutput) ToFlexTemplateJobOutput() FlexTemplateJobOutput {
return o
}
func (o FlexTemplateJobOutput) ToFlexTemplateJobOutputWithContext(ctx context.Context) FlexTemplateJobOutput {
return o
}
func (o FlexTemplateJobOutput) ToOutput(ctx context.Context) pulumix.Output[*FlexTemplateJob] {
return pulumix.Output[*FlexTemplateJob]{
OutputState: o.OutputState,
}
}
// List of experiments that should be used by the job. An example value is ["enable_stackdriver_agent_metrics"].
func (o FlexTemplateJobOutput) AdditionalExperiments() pulumi.StringArrayOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringArrayOutput { return v.AdditionalExperiments }).(pulumi.StringArrayOutput)
}
// The algorithm to use for autoscaling
func (o FlexTemplateJobOutput) AutoscalingAlgorithm() pulumi.StringPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringPtrOutput { return v.AutoscalingAlgorithm }).(pulumi.StringPtrOutput)
}
// The GCS path to the Dataflow job Flex
// Template.
//
// ***
func (o FlexTemplateJobOutput) ContainerSpecGcsPath() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.ContainerSpecGcsPath }).(pulumi.StringOutput)
}
// Indicates if the job should use the streaming engine feature.
func (o FlexTemplateJobOutput) EnableStreamingEngine() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.BoolPtrOutput { return v.EnableStreamingEngine }).(pulumi.BoolPtrOutput)
}
// The configuration for VM IPs. Options are "WORKER_IP_PUBLIC" or "WORKER_IP_PRIVATE".
func (o FlexTemplateJobOutput) IpConfiguration() pulumi.StringPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringPtrOutput { return v.IpConfiguration }).(pulumi.StringPtrOutput)
}
// The unique ID of this job.
func (o FlexTemplateJobOutput) JobId() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.JobId }).(pulumi.StringOutput)
}
// The name for the Cloud KMS key for the job. Key format is:
// projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY
func (o FlexTemplateJobOutput) KmsKeyName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringPtrOutput { return v.KmsKeyName }).(pulumi.StringPtrOutput)
}
// User labels to be specified for the job. Keys and values
// should follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
// page. **Note**: This field is marked as deprecated as the API does not currently
// support adding labels.
// **NOTE**: Google-provided Dataflow templates often provide default labels
// that begin with `goog-dataflow-provided`. Unless explicitly set in config, these
// labels will be ignored to prevent diffs on re-apply.
func (o FlexTemplateJobOutput) Labels() pulumi.MapOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.MapOutput { return v.Labels }).(pulumi.MapOutput)
}
// The machine type to use for launching the job. The default is n1-standard-1.
func (o FlexTemplateJobOutput) LauncherMachineType() pulumi.StringPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringPtrOutput { return v.LauncherMachineType }).(pulumi.StringPtrOutput)
}
// The machine type to use for the job.
func (o FlexTemplateJobOutput) MachineType() pulumi.StringPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringPtrOutput { return v.MachineType }).(pulumi.StringPtrOutput)
}
// The maximum number of Google Compute Engine instances to be made available to your pipeline during execution, from 1 to
// 1000.
func (o FlexTemplateJobOutput) MaxWorkers() pulumi.IntPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.IntPtrOutput { return v.MaxWorkers }).(pulumi.IntPtrOutput)
}
// A unique name for the resource, required by Dataflow.
func (o FlexTemplateJobOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The network to which VMs will be assigned. If it is not provided, "default" will be used.
func (o FlexTemplateJobOutput) Network() pulumi.StringPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringPtrOutput { return v.Network }).(pulumi.StringPtrOutput)
}
// The initial number of Google Compute Engine instances for the job.
func (o FlexTemplateJobOutput) NumWorkers() pulumi.IntPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.IntPtrOutput { return v.NumWorkers }).(pulumi.IntPtrOutput)
}
// One of "drain" or "cancel". Specifies behavior of
// deletion during `pulumi destroy`. See above note.
func (o FlexTemplateJobOutput) OnDelete() pulumi.StringPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringPtrOutput { return v.OnDelete }).(pulumi.StringPtrOutput)
}
// Key/Value pairs to be passed to the Dataflow job (as
// used in the template). Additional [pipeline options](https://cloud.google.com/dataflow/docs/guides/specifying-exec-params#setting-other-cloud-dataflow-pipeline-options)
// such as `serviceAccount`, `workerMachineType`, etc can be specified here.
func (o FlexTemplateJobOutput) Parameters() pulumi.MapOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.MapOutput { return v.Parameters }).(pulumi.MapOutput)
}
// The project in which the resource belongs. If it is not
// provided, the provider project is used.
func (o FlexTemplateJobOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// The region in which the created job should run.
func (o FlexTemplateJobOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)
}
// Docker registry location of container image to use for the 'worker harness. Default is the container for the version of
// the SDK. Note this field is only valid for portable pipelines.
func (o FlexTemplateJobOutput) SdkContainerImage() pulumi.StringPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringPtrOutput { return v.SdkContainerImage }).(pulumi.StringPtrOutput)
}
// The Service Account email used to create the job.
func (o FlexTemplateJobOutput) ServiceAccountEmail() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.ServiceAccountEmail }).(pulumi.StringOutput)
}
// If true, treat DRAINING and CANCELLING as terminal job states and do not wait for further changes before removing from
// terraform state and moving on. WARNING: this will lead to job name conflicts if you do not ensure that the job names are
// different, e.g. by embedding a release ID or by using a random_id.
func (o FlexTemplateJobOutput) SkipWaitOnJobTermination() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.BoolPtrOutput { return v.SkipWaitOnJobTermination }).(pulumi.BoolPtrOutput)
}
// The Cloud Storage path to use for staging files. Must be a valid Cloud Storage URL, beginning with gs://.
func (o FlexTemplateJobOutput) StagingLocation() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.StagingLocation }).(pulumi.StringOutput)
}
// The current state of the resource, selected from the [JobState enum](https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState)
func (o FlexTemplateJobOutput) State() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
}
// The subnetwork to which VMs will be assigned. Should be of the form "regions/REGION/subnetworks/SUBNETWORK".
func (o FlexTemplateJobOutput) Subnetwork() pulumi.StringPtrOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringPtrOutput { return v.Subnetwork }).(pulumi.StringPtrOutput)
}
// The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with gs://.
func (o FlexTemplateJobOutput) TempLocation() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.TempLocation }).(pulumi.StringOutput)
}
// Only applicable when updating a pipeline. Map of transform name prefixes of the job to be replaced with the
// corresponding name prefixes of the new job.
func (o FlexTemplateJobOutput) TransformNameMapping() pulumi.MapOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.MapOutput { return v.TransformNameMapping }).(pulumi.MapOutput)
}
// The type of this job, selected from the JobType enum.
func (o FlexTemplateJobOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *FlexTemplateJob) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
type FlexTemplateJobArrayOutput struct{ *pulumi.OutputState }
func (FlexTemplateJobArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*FlexTemplateJob)(nil)).Elem()
}
func (o FlexTemplateJobArrayOutput) ToFlexTemplateJobArrayOutput() FlexTemplateJobArrayOutput {
return o
}
func (o FlexTemplateJobArrayOutput) ToFlexTemplateJobArrayOutputWithContext(ctx context.Context) FlexTemplateJobArrayOutput {
return o
}
func (o FlexTemplateJobArrayOutput) ToOutput(ctx context.Context) pulumix.Output[[]*FlexTemplateJob] {
return pulumix.Output[[]*FlexTemplateJob]{
OutputState: o.OutputState,
}
}
func (o FlexTemplateJobArrayOutput) Index(i pulumi.IntInput) FlexTemplateJobOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *FlexTemplateJob {
return vs[0].([]*FlexTemplateJob)[vs[1].(int)]
}).(FlexTemplateJobOutput)
}
type FlexTemplateJobMapOutput struct{ *pulumi.OutputState }
func (FlexTemplateJobMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*FlexTemplateJob)(nil)).Elem()
}
func (o FlexTemplateJobMapOutput) ToFlexTemplateJobMapOutput() FlexTemplateJobMapOutput {
return o
}
func (o FlexTemplateJobMapOutput) ToFlexTemplateJobMapOutputWithContext(ctx context.Context) FlexTemplateJobMapOutput {
return o
}
func (o FlexTemplateJobMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]*FlexTemplateJob] {
return pulumix.Output[map[string]*FlexTemplateJob]{
OutputState: o.OutputState,
}
}
func (o FlexTemplateJobMapOutput) MapIndex(k pulumi.StringInput) FlexTemplateJobOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *FlexTemplateJob {
return vs[0].(map[string]*FlexTemplateJob)[vs[1].(string)]
}).(FlexTemplateJobOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*FlexTemplateJobInput)(nil)).Elem(), &FlexTemplateJob{})
pulumi.RegisterInputType(reflect.TypeOf((*FlexTemplateJobArrayInput)(nil)).Elem(), FlexTemplateJobArray{})
pulumi.RegisterInputType(reflect.TypeOf((*FlexTemplateJobMapInput)(nil)).Elem(), FlexTemplateJobMap{})
pulumi.RegisterOutputType(FlexTemplateJobOutput{})
pulumi.RegisterOutputType(FlexTemplateJobArrayOutput{})
pulumi.RegisterOutputType(FlexTemplateJobMapOutput{})
}