/
instanceTemplate.go
881 lines (820 loc) · 43.2 KB
/
instanceTemplate.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
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
// *** 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 compute
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a VM instance template resource within GCE. For more information see
// [the official documentation](https://cloud.google.com/compute/docs/instance-templates)
// and
// [API](https://cloud.google.com/compute/docs/reference/latest/instanceTemplates).
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/compute"
// "github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/serviceAccount"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// defaultAccount, err := serviceAccount.NewAccount(ctx, "defaultAccount", &serviceAccount.AccountArgs{
// AccountId: pulumi.String("service-account-id"),
// DisplayName: pulumi.String("Service Account"),
// })
// if err != nil {
// return err
// }
// opt0 := "debian-9"
// opt1 := "debian-cloud"
// myImage, err := compute.LookupImage(ctx, &compute.LookupImageArgs{
// Family: &opt0,
// Project: &opt1,
// }, nil)
// if err != nil {
// return err
// }
// foobar, err := compute.NewDisk(ctx, "foobar", &compute.DiskArgs{
// Image: pulumi.String(myImage.SelfLink),
// Size: pulumi.Int(10),
// Type: pulumi.String("pd-ssd"),
// Zone: pulumi.String("us-central1-a"),
// })
// if err != nil {
// return err
// }
// dailyBackup, err := compute.NewResourcePolicy(ctx, "dailyBackup", &compute.ResourcePolicyArgs{
// Region: pulumi.String("us-central1"),
// SnapshotSchedulePolicy: &compute.ResourcePolicySnapshotSchedulePolicyArgs{
// Schedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleArgs{
// DailySchedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs{
// DaysInCycle: pulumi.Int(1),
// StartTime: pulumi.String("04:00"),
// },
// },
// },
// })
// if err != nil {
// return err
// }
// _, err = compute.NewInstanceTemplate(ctx, "defaultInstanceTemplate", &compute.InstanceTemplateArgs{
// Description: pulumi.String("This template is used to create app server instances."),
// Tags: pulumi.StringArray{
// pulumi.String("foo"),
// pulumi.String("bar"),
// },
// Labels: pulumi.StringMap{
// "environment": pulumi.String("dev"),
// },
// InstanceDescription: pulumi.String("description assigned to instances"),
// MachineType: pulumi.String("e2-medium"),
// CanIpForward: pulumi.Bool(false),
// Scheduling: &compute.InstanceTemplateSchedulingArgs{
// AutomaticRestart: pulumi.Bool(true),
// OnHostMaintenance: pulumi.String("MIGRATE"),
// },
// Disks: compute.InstanceTemplateDiskArray{
// &compute.InstanceTemplateDiskArgs{
// SourceImage: pulumi.String("debian-cloud/debian-9"),
// AutoDelete: pulumi.Bool(true),
// Boot: pulumi.Bool(true),
// ResourcePolicies: pulumi.String{
// dailyBackup.ID(),
// },
// },
// &compute.InstanceTemplateDiskArgs{
// Source: foobar.Name,
// AutoDelete: pulumi.Bool(false),
// Boot: pulumi.Bool(false),
// },
// },
// NetworkInterfaces: compute.InstanceTemplateNetworkInterfaceArray{
// &compute.InstanceTemplateNetworkInterfaceArgs{
// Network: pulumi.String("default"),
// },
// },
// Metadata: pulumi.AnyMap{
// "foo": pulumi.Any("bar"),
// },
// ServiceAccount: &compute.InstanceTemplateServiceAccountArgs{
// Email: defaultAccount.Email,
// Scopes: pulumi.StringArray{
// pulumi.String("cloud-platform"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// ## Deploying the Latest Image
//
// A common way to use instance templates and managed instance groups is to deploy the
// latest image in a family, usually the latest build of your application. There are two
// ways to do this in the provider, and they have their pros and cons. The difference ends
// up being in how "latest" is interpreted. You can either deploy the latest image available
// when the provider runs, or you can have each instance check what the latest image is when
// it's being created, either as part of a scaling event or being rebuilt by the instance
// group manager.
//
// If you're not sure, we recommend deploying the latest image available when the provider runs,
// because this means all the instances in your group will be based on the same image, always,
// and means that no upgrades or changes to your instances happen outside of a `pulumi up`.
// You can achieve this by using the `compute.Image`
// data source, which will retrieve the latest image on every `pulumi apply`, and will update
// the template to use that specific image:
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/compute"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// opt0 := "debian-9"
// opt1 := "debian-cloud"
// _, err := compute.LookupImage(ctx, &compute.LookupImageArgs{
// Family: &opt0,
// Project: &opt1,
// }, nil)
// if err != nil {
// return err
// }
// _, err = compute.NewInstanceTemplate(ctx, "instanceTemplate", &compute.InstanceTemplateArgs{
// NamePrefix: pulumi.String("instance-template-"),
// MachineType: pulumi.String("e2-medium"),
// Region: pulumi.String("us-central1"),
// Disks: compute.InstanceTemplateDiskArray{
// &compute.InstanceTemplateDiskArgs{
// SourceImage: pulumi.Any(google_compute_image.My_image.Self_link),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// To have instances update to the latest on every scaling event or instance re-creation,
// use the family as the image for the disk, and it will use GCP's default behavior, setting
// the image for the template to the family:
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/compute"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := compute.NewInstanceTemplate(ctx, "instanceTemplate", &compute.InstanceTemplateArgs{
// Disks: compute.InstanceTemplateDiskArray{
// &compute.InstanceTemplateDiskArgs{
// SourceImage: pulumi.String("debian-cloud/debian-9"),
// },
// },
// MachineType: pulumi.String("e2-medium"),
// NamePrefix: pulumi.String("instance-template-"),
// Region: pulumi.String("us-central1"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Instance templates can be imported using any of these accepted formats
//
// ```sh
// $ pulumi import gcp:compute/instanceTemplate:InstanceTemplate default projects/{{project}}/global/instanceTemplates/{{name}}
// ```
//
// ```sh
// $ pulumi import gcp:compute/instanceTemplate:InstanceTemplate default {{project}}/{{name}}
// ```
//
// ```sh
// $ pulumi import gcp:compute/instanceTemplate:InstanceTemplate default {{name}}
// ```
//
// [custom-vm-types]https://cloud.google.com/dataproc/docs/concepts/compute/custom-machine-types [network-tier]https://cloud.google.com/network-tiers/docs/overview
type InstanceTemplate struct {
pulumi.CustomResourceState
// Configure Nested Virtualisation and Simultaneous Hyper Threading on this VM. Structure is documented below
AdvancedMachineFeatures InstanceTemplateAdvancedMachineFeaturesOutput `pulumi:"advancedMachineFeatures"`
// Whether to allow sending and receiving of
// packets with non-matching source or destination IPs. This defaults to false.
CanIpForward pulumi.BoolPtrOutput `pulumi:"canIpForward"`
// Enable [Confidential Mode](https://cloud.google.com/compute/confidential-vm/docs/about-cvm) on this VM. Structure is documented below
ConfidentialInstanceConfig InstanceTemplateConfidentialInstanceConfigOutput `pulumi:"confidentialInstanceConfig"`
// A brief description of this resource.
Description pulumi.StringPtrOutput `pulumi:"description"`
// Disks to attach to instances created from this template.
// This can be specified multiple times for multiple disks. Structure is
// documented below.
Disks InstanceTemplateDiskArrayOutput `pulumi:"disks"`
// ) Enable [Virtual Displays](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display#verify_display_driver) on this instance.
// **Note**: `allowStoppingForUpdate` must be set to true in order to update this field. Note: This attribute is currently in beta and will be removed from the google provider. Please use the google-beta provider to continue using this attribute.
EnableDisplay pulumi.BoolPtrOutput `pulumi:"enableDisplay"`
// List of the type and count of accelerator cards attached to the instance. Structure documented below.
GuestAccelerators InstanceTemplateGuestAcceleratorArrayOutput `pulumi:"guestAccelerators"`
// A brief description to use for instances
// created from this template.
InstanceDescription pulumi.StringPtrOutput `pulumi:"instanceDescription"`
// A set of ket/value label pairs to assign to disk created from
// this template
Labels pulumi.StringMapOutput `pulumi:"labels"`
// The machine type to create.
MachineType pulumi.StringOutput `pulumi:"machineType"`
// Metadata key/value pairs to make available from
// within instances created from this template.
Metadata pulumi.MapOutput `pulumi:"metadata"`
// The unique fingerprint of the metadata.
MetadataFingerprint pulumi.StringOutput `pulumi:"metadataFingerprint"`
// An alternative to using the
// startup-script metadata key, mostly to match the computeInstance resource.
// This replaces the startup-script metadata key on the created instance and
// thus the two mechanisms are not allowed to be used simultaneously.
MetadataStartupScript pulumi.StringPtrOutput `pulumi:"metadataStartupScript"`
// Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as
// `Intel Haswell` or `Intel Skylake`. See the complete list [here](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform).
MinCpuPlatform pulumi.StringPtrOutput `pulumi:"minCpuPlatform"`
// The name of the instance template. If you leave
// this blank, the provider will auto-generate a unique name.
Name pulumi.StringOutput `pulumi:"name"`
// Creates a unique name beginning with the specified
// prefix. Conflicts with `name`.
NamePrefix pulumi.StringOutput `pulumi:"namePrefix"`
// Networks to attach to instances created from
// this template. This can be specified multiple times for multiple networks.
// Structure is documented below.
NetworkInterfaces InstanceTemplateNetworkInterfaceArrayOutput `pulumi:"networkInterfaces"`
// Configures network performance settings for the instance created from the
// template. Structure is documented below. **Note**: `machineType`
// must be a [supported type](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration),
// the `image` used must include the [`GVNIC`](https://cloud.google.com/compute/docs/networking/using-gvnic#create-instance-gvnic-image)
// in `guest-os-features`, and `network_interface.0.nic-type` must be `GVNIC`
// in order for this setting to take effect.
NetworkPerformanceConfig InstanceTemplateNetworkPerformanceConfigPtrOutput `pulumi:"networkPerformanceConfig"`
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringOutput `pulumi:"project"`
// An instance template is a global resource that is not
// bound to a zone or a region. However, you can still specify some regional
// resources in an instance template, which restricts the template to the
// region where that resource resides. For example, a custom `subnetwork`
// resource is tied to a specific region. Defaults to the region of the
// Provider if no value is given.
Region pulumi.StringOutput `pulumi:"region"`
// Specifies the reservations that this instance can consume from.
// Structure is documented below.
ReservationAffinity InstanceTemplateReservationAffinityPtrOutput `pulumi:"reservationAffinity"`
// The scheduling strategy to use. More details about
// this configuration option are detailed below.
Scheduling InstanceTemplateSchedulingOutput `pulumi:"scheduling"`
// The URI of the created resource.
SelfLink pulumi.StringOutput `pulumi:"selfLink"`
// Service account to attach to the instance. Structure is documented below.
ServiceAccount InstanceTemplateServiceAccountPtrOutput `pulumi:"serviceAccount"`
// Enable [Shielded VM](https://cloud.google.com/security/shielded-cloud/shielded-vm) on this instance. Shielded VM provides verifiable integrity to prevent against malware and rootkits. Defaults to disabled. Structure is documented below.
// **Note**: `shieldedInstanceConfig` can only be used with boot images with shielded vm support. See the complete list [here](https://cloud.google.com/compute/docs/images#shielded-images).
ShieldedInstanceConfig InstanceTemplateShieldedInstanceConfigOutput `pulumi:"shieldedInstanceConfig"`
// Tags to attach to the instance.
Tags pulumi.StringArrayOutput `pulumi:"tags"`
// The unique fingerprint of the tags.
TagsFingerprint pulumi.StringOutput `pulumi:"tagsFingerprint"`
}
// NewInstanceTemplate registers a new resource with the given unique name, arguments, and options.
func NewInstanceTemplate(ctx *pulumi.Context,
name string, args *InstanceTemplateArgs, opts ...pulumi.ResourceOption) (*InstanceTemplate, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Disks == nil {
return nil, errors.New("invalid value for required argument 'Disks'")
}
if args.MachineType == nil {
return nil, errors.New("invalid value for required argument 'MachineType'")
}
var resource InstanceTemplate
err := ctx.RegisterResource("gcp:compute/instanceTemplate:InstanceTemplate", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetInstanceTemplate gets an existing InstanceTemplate 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 GetInstanceTemplate(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *InstanceTemplateState, opts ...pulumi.ResourceOption) (*InstanceTemplate, error) {
var resource InstanceTemplate
err := ctx.ReadResource("gcp:compute/instanceTemplate:InstanceTemplate", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering InstanceTemplate resources.
type instanceTemplateState struct {
// Configure Nested Virtualisation and Simultaneous Hyper Threading on this VM. Structure is documented below
AdvancedMachineFeatures *InstanceTemplateAdvancedMachineFeatures `pulumi:"advancedMachineFeatures"`
// Whether to allow sending and receiving of
// packets with non-matching source or destination IPs. This defaults to false.
CanIpForward *bool `pulumi:"canIpForward"`
// Enable [Confidential Mode](https://cloud.google.com/compute/confidential-vm/docs/about-cvm) on this VM. Structure is documented below
ConfidentialInstanceConfig *InstanceTemplateConfidentialInstanceConfig `pulumi:"confidentialInstanceConfig"`
// A brief description of this resource.
Description *string `pulumi:"description"`
// Disks to attach to instances created from this template.
// This can be specified multiple times for multiple disks. Structure is
// documented below.
Disks []InstanceTemplateDisk `pulumi:"disks"`
// ) Enable [Virtual Displays](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display#verify_display_driver) on this instance.
// **Note**: `allowStoppingForUpdate` must be set to true in order to update this field. Note: This attribute is currently in beta and will be removed from the google provider. Please use the google-beta provider to continue using this attribute.
EnableDisplay *bool `pulumi:"enableDisplay"`
// List of the type and count of accelerator cards attached to the instance. Structure documented below.
GuestAccelerators []InstanceTemplateGuestAccelerator `pulumi:"guestAccelerators"`
// A brief description to use for instances
// created from this template.
InstanceDescription *string `pulumi:"instanceDescription"`
// A set of ket/value label pairs to assign to disk created from
// this template
Labels map[string]string `pulumi:"labels"`
// The machine type to create.
MachineType *string `pulumi:"machineType"`
// Metadata key/value pairs to make available from
// within instances created from this template.
Metadata map[string]interface{} `pulumi:"metadata"`
// The unique fingerprint of the metadata.
MetadataFingerprint *string `pulumi:"metadataFingerprint"`
// An alternative to using the
// startup-script metadata key, mostly to match the computeInstance resource.
// This replaces the startup-script metadata key on the created instance and
// thus the two mechanisms are not allowed to be used simultaneously.
MetadataStartupScript *string `pulumi:"metadataStartupScript"`
// Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as
// `Intel Haswell` or `Intel Skylake`. See the complete list [here](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform).
MinCpuPlatform *string `pulumi:"minCpuPlatform"`
// The name of the instance template. If you leave
// this blank, the provider will auto-generate a unique name.
Name *string `pulumi:"name"`
// Creates a unique name beginning with the specified
// prefix. Conflicts with `name`.
NamePrefix *string `pulumi:"namePrefix"`
// Networks to attach to instances created from
// this template. This can be specified multiple times for multiple networks.
// Structure is documented below.
NetworkInterfaces []InstanceTemplateNetworkInterface `pulumi:"networkInterfaces"`
// Configures network performance settings for the instance created from the
// template. Structure is documented below. **Note**: `machineType`
// must be a [supported type](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration),
// the `image` used must include the [`GVNIC`](https://cloud.google.com/compute/docs/networking/using-gvnic#create-instance-gvnic-image)
// in `guest-os-features`, and `network_interface.0.nic-type` must be `GVNIC`
// in order for this setting to take effect.
NetworkPerformanceConfig *InstanceTemplateNetworkPerformanceConfig `pulumi:"networkPerformanceConfig"`
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project *string `pulumi:"project"`
// An instance template is a global resource that is not
// bound to a zone or a region. However, you can still specify some regional
// resources in an instance template, which restricts the template to the
// region where that resource resides. For example, a custom `subnetwork`
// resource is tied to a specific region. Defaults to the region of the
// Provider if no value is given.
Region *string `pulumi:"region"`
// Specifies the reservations that this instance can consume from.
// Structure is documented below.
ReservationAffinity *InstanceTemplateReservationAffinity `pulumi:"reservationAffinity"`
// The scheduling strategy to use. More details about
// this configuration option are detailed below.
Scheduling *InstanceTemplateScheduling `pulumi:"scheduling"`
// The URI of the created resource.
SelfLink *string `pulumi:"selfLink"`
// Service account to attach to the instance. Structure is documented below.
ServiceAccount *InstanceTemplateServiceAccount `pulumi:"serviceAccount"`
// Enable [Shielded VM](https://cloud.google.com/security/shielded-cloud/shielded-vm) on this instance. Shielded VM provides verifiable integrity to prevent against malware and rootkits. Defaults to disabled. Structure is documented below.
// **Note**: `shieldedInstanceConfig` can only be used with boot images with shielded vm support. See the complete list [here](https://cloud.google.com/compute/docs/images#shielded-images).
ShieldedInstanceConfig *InstanceTemplateShieldedInstanceConfig `pulumi:"shieldedInstanceConfig"`
// Tags to attach to the instance.
Tags []string `pulumi:"tags"`
// The unique fingerprint of the tags.
TagsFingerprint *string `pulumi:"tagsFingerprint"`
}
type InstanceTemplateState struct {
// Configure Nested Virtualisation and Simultaneous Hyper Threading on this VM. Structure is documented below
AdvancedMachineFeatures InstanceTemplateAdvancedMachineFeaturesPtrInput
// Whether to allow sending and receiving of
// packets with non-matching source or destination IPs. This defaults to false.
CanIpForward pulumi.BoolPtrInput
// Enable [Confidential Mode](https://cloud.google.com/compute/confidential-vm/docs/about-cvm) on this VM. Structure is documented below
ConfidentialInstanceConfig InstanceTemplateConfidentialInstanceConfigPtrInput
// A brief description of this resource.
Description pulumi.StringPtrInput
// Disks to attach to instances created from this template.
// This can be specified multiple times for multiple disks. Structure is
// documented below.
Disks InstanceTemplateDiskArrayInput
// ) Enable [Virtual Displays](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display#verify_display_driver) on this instance.
// **Note**: `allowStoppingForUpdate` must be set to true in order to update this field. Note: This attribute is currently in beta and will be removed from the google provider. Please use the google-beta provider to continue using this attribute.
EnableDisplay pulumi.BoolPtrInput
// List of the type and count of accelerator cards attached to the instance. Structure documented below.
GuestAccelerators InstanceTemplateGuestAcceleratorArrayInput
// A brief description to use for instances
// created from this template.
InstanceDescription pulumi.StringPtrInput
// A set of ket/value label pairs to assign to disk created from
// this template
Labels pulumi.StringMapInput
// The machine type to create.
MachineType pulumi.StringPtrInput
// Metadata key/value pairs to make available from
// within instances created from this template.
Metadata pulumi.MapInput
// The unique fingerprint of the metadata.
MetadataFingerprint pulumi.StringPtrInput
// An alternative to using the
// startup-script metadata key, mostly to match the computeInstance resource.
// This replaces the startup-script metadata key on the created instance and
// thus the two mechanisms are not allowed to be used simultaneously.
MetadataStartupScript pulumi.StringPtrInput
// Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as
// `Intel Haswell` or `Intel Skylake`. See the complete list [here](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform).
MinCpuPlatform pulumi.StringPtrInput
// The name of the instance template. If you leave
// this blank, the provider will auto-generate a unique name.
Name pulumi.StringPtrInput
// Creates a unique name beginning with the specified
// prefix. Conflicts with `name`.
NamePrefix pulumi.StringPtrInput
// Networks to attach to instances created from
// this template. This can be specified multiple times for multiple networks.
// Structure is documented below.
NetworkInterfaces InstanceTemplateNetworkInterfaceArrayInput
// Configures network performance settings for the instance created from the
// template. Structure is documented below. **Note**: `machineType`
// must be a [supported type](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration),
// the `image` used must include the [`GVNIC`](https://cloud.google.com/compute/docs/networking/using-gvnic#create-instance-gvnic-image)
// in `guest-os-features`, and `network_interface.0.nic-type` must be `GVNIC`
// in order for this setting to take effect.
NetworkPerformanceConfig InstanceTemplateNetworkPerformanceConfigPtrInput
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringPtrInput
// An instance template is a global resource that is not
// bound to a zone or a region. However, you can still specify some regional
// resources in an instance template, which restricts the template to the
// region where that resource resides. For example, a custom `subnetwork`
// resource is tied to a specific region. Defaults to the region of the
// Provider if no value is given.
Region pulumi.StringPtrInput
// Specifies the reservations that this instance can consume from.
// Structure is documented below.
ReservationAffinity InstanceTemplateReservationAffinityPtrInput
// The scheduling strategy to use. More details about
// this configuration option are detailed below.
Scheduling InstanceTemplateSchedulingPtrInput
// The URI of the created resource.
SelfLink pulumi.StringPtrInput
// Service account to attach to the instance. Structure is documented below.
ServiceAccount InstanceTemplateServiceAccountPtrInput
// Enable [Shielded VM](https://cloud.google.com/security/shielded-cloud/shielded-vm) on this instance. Shielded VM provides verifiable integrity to prevent against malware and rootkits. Defaults to disabled. Structure is documented below.
// **Note**: `shieldedInstanceConfig` can only be used with boot images with shielded vm support. See the complete list [here](https://cloud.google.com/compute/docs/images#shielded-images).
ShieldedInstanceConfig InstanceTemplateShieldedInstanceConfigPtrInput
// Tags to attach to the instance.
Tags pulumi.StringArrayInput
// The unique fingerprint of the tags.
TagsFingerprint pulumi.StringPtrInput
}
func (InstanceTemplateState) ElementType() reflect.Type {
return reflect.TypeOf((*instanceTemplateState)(nil)).Elem()
}
type instanceTemplateArgs struct {
// Configure Nested Virtualisation and Simultaneous Hyper Threading on this VM. Structure is documented below
AdvancedMachineFeatures *InstanceTemplateAdvancedMachineFeatures `pulumi:"advancedMachineFeatures"`
// Whether to allow sending and receiving of
// packets with non-matching source or destination IPs. This defaults to false.
CanIpForward *bool `pulumi:"canIpForward"`
// Enable [Confidential Mode](https://cloud.google.com/compute/confidential-vm/docs/about-cvm) on this VM. Structure is documented below
ConfidentialInstanceConfig *InstanceTemplateConfidentialInstanceConfig `pulumi:"confidentialInstanceConfig"`
// A brief description of this resource.
Description *string `pulumi:"description"`
// Disks to attach to instances created from this template.
// This can be specified multiple times for multiple disks. Structure is
// documented below.
Disks []InstanceTemplateDisk `pulumi:"disks"`
// ) Enable [Virtual Displays](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display#verify_display_driver) on this instance.
// **Note**: `allowStoppingForUpdate` must be set to true in order to update this field. Note: This attribute is currently in beta and will be removed from the google provider. Please use the google-beta provider to continue using this attribute.
EnableDisplay *bool `pulumi:"enableDisplay"`
// List of the type and count of accelerator cards attached to the instance. Structure documented below.
GuestAccelerators []InstanceTemplateGuestAccelerator `pulumi:"guestAccelerators"`
// A brief description to use for instances
// created from this template.
InstanceDescription *string `pulumi:"instanceDescription"`
// A set of ket/value label pairs to assign to disk created from
// this template
Labels map[string]string `pulumi:"labels"`
// The machine type to create.
MachineType string `pulumi:"machineType"`
// Metadata key/value pairs to make available from
// within instances created from this template.
Metadata map[string]interface{} `pulumi:"metadata"`
// An alternative to using the
// startup-script metadata key, mostly to match the computeInstance resource.
// This replaces the startup-script metadata key on the created instance and
// thus the two mechanisms are not allowed to be used simultaneously.
MetadataStartupScript *string `pulumi:"metadataStartupScript"`
// Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as
// `Intel Haswell` or `Intel Skylake`. See the complete list [here](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform).
MinCpuPlatform *string `pulumi:"minCpuPlatform"`
// The name of the instance template. If you leave
// this blank, the provider will auto-generate a unique name.
Name *string `pulumi:"name"`
// Creates a unique name beginning with the specified
// prefix. Conflicts with `name`.
NamePrefix *string `pulumi:"namePrefix"`
// Networks to attach to instances created from
// this template. This can be specified multiple times for multiple networks.
// Structure is documented below.
NetworkInterfaces []InstanceTemplateNetworkInterface `pulumi:"networkInterfaces"`
// Configures network performance settings for the instance created from the
// template. Structure is documented below. **Note**: `machineType`
// must be a [supported type](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration),
// the `image` used must include the [`GVNIC`](https://cloud.google.com/compute/docs/networking/using-gvnic#create-instance-gvnic-image)
// in `guest-os-features`, and `network_interface.0.nic-type` must be `GVNIC`
// in order for this setting to take effect.
NetworkPerformanceConfig *InstanceTemplateNetworkPerformanceConfig `pulumi:"networkPerformanceConfig"`
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project *string `pulumi:"project"`
// An instance template is a global resource that is not
// bound to a zone or a region. However, you can still specify some regional
// resources in an instance template, which restricts the template to the
// region where that resource resides. For example, a custom `subnetwork`
// resource is tied to a specific region. Defaults to the region of the
// Provider if no value is given.
Region *string `pulumi:"region"`
// Specifies the reservations that this instance can consume from.
// Structure is documented below.
ReservationAffinity *InstanceTemplateReservationAffinity `pulumi:"reservationAffinity"`
// The scheduling strategy to use. More details about
// this configuration option are detailed below.
Scheduling *InstanceTemplateScheduling `pulumi:"scheduling"`
// Service account to attach to the instance. Structure is documented below.
ServiceAccount *InstanceTemplateServiceAccount `pulumi:"serviceAccount"`
// Enable [Shielded VM](https://cloud.google.com/security/shielded-cloud/shielded-vm) on this instance. Shielded VM provides verifiable integrity to prevent against malware and rootkits. Defaults to disabled. Structure is documented below.
// **Note**: `shieldedInstanceConfig` can only be used with boot images with shielded vm support. See the complete list [here](https://cloud.google.com/compute/docs/images#shielded-images).
ShieldedInstanceConfig *InstanceTemplateShieldedInstanceConfig `pulumi:"shieldedInstanceConfig"`
// Tags to attach to the instance.
Tags []string `pulumi:"tags"`
}
// The set of arguments for constructing a InstanceTemplate resource.
type InstanceTemplateArgs struct {
// Configure Nested Virtualisation and Simultaneous Hyper Threading on this VM. Structure is documented below
AdvancedMachineFeatures InstanceTemplateAdvancedMachineFeaturesPtrInput
// Whether to allow sending and receiving of
// packets with non-matching source or destination IPs. This defaults to false.
CanIpForward pulumi.BoolPtrInput
// Enable [Confidential Mode](https://cloud.google.com/compute/confidential-vm/docs/about-cvm) on this VM. Structure is documented below
ConfidentialInstanceConfig InstanceTemplateConfidentialInstanceConfigPtrInput
// A brief description of this resource.
Description pulumi.StringPtrInput
// Disks to attach to instances created from this template.
// This can be specified multiple times for multiple disks. Structure is
// documented below.
Disks InstanceTemplateDiskArrayInput
// ) Enable [Virtual Displays](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display#verify_display_driver) on this instance.
// **Note**: `allowStoppingForUpdate` must be set to true in order to update this field. Note: This attribute is currently in beta and will be removed from the google provider. Please use the google-beta provider to continue using this attribute.
EnableDisplay pulumi.BoolPtrInput
// List of the type and count of accelerator cards attached to the instance. Structure documented below.
GuestAccelerators InstanceTemplateGuestAcceleratorArrayInput
// A brief description to use for instances
// created from this template.
InstanceDescription pulumi.StringPtrInput
// A set of ket/value label pairs to assign to disk created from
// this template
Labels pulumi.StringMapInput
// The machine type to create.
MachineType pulumi.StringInput
// Metadata key/value pairs to make available from
// within instances created from this template.
Metadata pulumi.MapInput
// An alternative to using the
// startup-script metadata key, mostly to match the computeInstance resource.
// This replaces the startup-script metadata key on the created instance and
// thus the two mechanisms are not allowed to be used simultaneously.
MetadataStartupScript pulumi.StringPtrInput
// Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as
// `Intel Haswell` or `Intel Skylake`. See the complete list [here](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform).
MinCpuPlatform pulumi.StringPtrInput
// The name of the instance template. If you leave
// this blank, the provider will auto-generate a unique name.
Name pulumi.StringPtrInput
// Creates a unique name beginning with the specified
// prefix. Conflicts with `name`.
NamePrefix pulumi.StringPtrInput
// Networks to attach to instances created from
// this template. This can be specified multiple times for multiple networks.
// Structure is documented below.
NetworkInterfaces InstanceTemplateNetworkInterfaceArrayInput
// Configures network performance settings for the instance created from the
// template. Structure is documented below. **Note**: `machineType`
// must be a [supported type](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration),
// the `image` used must include the [`GVNIC`](https://cloud.google.com/compute/docs/networking/using-gvnic#create-instance-gvnic-image)
// in `guest-os-features`, and `network_interface.0.nic-type` must be `GVNIC`
// in order for this setting to take effect.
NetworkPerformanceConfig InstanceTemplateNetworkPerformanceConfigPtrInput
// The ID of the project in which the resource belongs. If it
// is not provided, the provider project is used.
Project pulumi.StringPtrInput
// An instance template is a global resource that is not
// bound to a zone or a region. However, you can still specify some regional
// resources in an instance template, which restricts the template to the
// region where that resource resides. For example, a custom `subnetwork`
// resource is tied to a specific region. Defaults to the region of the
// Provider if no value is given.
Region pulumi.StringPtrInput
// Specifies the reservations that this instance can consume from.
// Structure is documented below.
ReservationAffinity InstanceTemplateReservationAffinityPtrInput
// The scheduling strategy to use. More details about
// this configuration option are detailed below.
Scheduling InstanceTemplateSchedulingPtrInput
// Service account to attach to the instance. Structure is documented below.
ServiceAccount InstanceTemplateServiceAccountPtrInput
// Enable [Shielded VM](https://cloud.google.com/security/shielded-cloud/shielded-vm) on this instance. Shielded VM provides verifiable integrity to prevent against malware and rootkits. Defaults to disabled. Structure is documented below.
// **Note**: `shieldedInstanceConfig` can only be used with boot images with shielded vm support. See the complete list [here](https://cloud.google.com/compute/docs/images#shielded-images).
ShieldedInstanceConfig InstanceTemplateShieldedInstanceConfigPtrInput
// Tags to attach to the instance.
Tags pulumi.StringArrayInput
}
func (InstanceTemplateArgs) ElementType() reflect.Type {
return reflect.TypeOf((*instanceTemplateArgs)(nil)).Elem()
}
type InstanceTemplateInput interface {
pulumi.Input
ToInstanceTemplateOutput() InstanceTemplateOutput
ToInstanceTemplateOutputWithContext(ctx context.Context) InstanceTemplateOutput
}
func (*InstanceTemplate) ElementType() reflect.Type {
return reflect.TypeOf((*InstanceTemplate)(nil))
}
func (i *InstanceTemplate) ToInstanceTemplateOutput() InstanceTemplateOutput {
return i.ToInstanceTemplateOutputWithContext(context.Background())
}
func (i *InstanceTemplate) ToInstanceTemplateOutputWithContext(ctx context.Context) InstanceTemplateOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceTemplateOutput)
}
func (i *InstanceTemplate) ToInstanceTemplatePtrOutput() InstanceTemplatePtrOutput {
return i.ToInstanceTemplatePtrOutputWithContext(context.Background())
}
func (i *InstanceTemplate) ToInstanceTemplatePtrOutputWithContext(ctx context.Context) InstanceTemplatePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceTemplatePtrOutput)
}
type InstanceTemplatePtrInput interface {
pulumi.Input
ToInstanceTemplatePtrOutput() InstanceTemplatePtrOutput
ToInstanceTemplatePtrOutputWithContext(ctx context.Context) InstanceTemplatePtrOutput
}
type instanceTemplatePtrType InstanceTemplateArgs
func (*instanceTemplatePtrType) ElementType() reflect.Type {
return reflect.TypeOf((**InstanceTemplate)(nil))
}
func (i *instanceTemplatePtrType) ToInstanceTemplatePtrOutput() InstanceTemplatePtrOutput {
return i.ToInstanceTemplatePtrOutputWithContext(context.Background())
}
func (i *instanceTemplatePtrType) ToInstanceTemplatePtrOutputWithContext(ctx context.Context) InstanceTemplatePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceTemplatePtrOutput)
}
// InstanceTemplateArrayInput is an input type that accepts InstanceTemplateArray and InstanceTemplateArrayOutput values.
// You can construct a concrete instance of `InstanceTemplateArrayInput` via:
//
// InstanceTemplateArray{ InstanceTemplateArgs{...} }
type InstanceTemplateArrayInput interface {
pulumi.Input
ToInstanceTemplateArrayOutput() InstanceTemplateArrayOutput
ToInstanceTemplateArrayOutputWithContext(context.Context) InstanceTemplateArrayOutput
}
type InstanceTemplateArray []InstanceTemplateInput
func (InstanceTemplateArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*InstanceTemplate)(nil)).Elem()
}
func (i InstanceTemplateArray) ToInstanceTemplateArrayOutput() InstanceTemplateArrayOutput {
return i.ToInstanceTemplateArrayOutputWithContext(context.Background())
}
func (i InstanceTemplateArray) ToInstanceTemplateArrayOutputWithContext(ctx context.Context) InstanceTemplateArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceTemplateArrayOutput)
}
// InstanceTemplateMapInput is an input type that accepts InstanceTemplateMap and InstanceTemplateMapOutput values.
// You can construct a concrete instance of `InstanceTemplateMapInput` via:
//
// InstanceTemplateMap{ "key": InstanceTemplateArgs{...} }
type InstanceTemplateMapInput interface {
pulumi.Input
ToInstanceTemplateMapOutput() InstanceTemplateMapOutput
ToInstanceTemplateMapOutputWithContext(context.Context) InstanceTemplateMapOutput
}
type InstanceTemplateMap map[string]InstanceTemplateInput
func (InstanceTemplateMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*InstanceTemplate)(nil)).Elem()
}
func (i InstanceTemplateMap) ToInstanceTemplateMapOutput() InstanceTemplateMapOutput {
return i.ToInstanceTemplateMapOutputWithContext(context.Background())
}
func (i InstanceTemplateMap) ToInstanceTemplateMapOutputWithContext(ctx context.Context) InstanceTemplateMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceTemplateMapOutput)
}
type InstanceTemplateOutput struct{ *pulumi.OutputState }
func (InstanceTemplateOutput) ElementType() reflect.Type {
return reflect.TypeOf((*InstanceTemplate)(nil))
}
func (o InstanceTemplateOutput) ToInstanceTemplateOutput() InstanceTemplateOutput {
return o
}
func (o InstanceTemplateOutput) ToInstanceTemplateOutputWithContext(ctx context.Context) InstanceTemplateOutput {
return o
}
func (o InstanceTemplateOutput) ToInstanceTemplatePtrOutput() InstanceTemplatePtrOutput {
return o.ToInstanceTemplatePtrOutputWithContext(context.Background())
}
func (o InstanceTemplateOutput) ToInstanceTemplatePtrOutputWithContext(ctx context.Context) InstanceTemplatePtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v InstanceTemplate) *InstanceTemplate {
return &v
}).(InstanceTemplatePtrOutput)
}
type InstanceTemplatePtrOutput struct{ *pulumi.OutputState }
func (InstanceTemplatePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**InstanceTemplate)(nil))
}
func (o InstanceTemplatePtrOutput) ToInstanceTemplatePtrOutput() InstanceTemplatePtrOutput {
return o
}
func (o InstanceTemplatePtrOutput) ToInstanceTemplatePtrOutputWithContext(ctx context.Context) InstanceTemplatePtrOutput {
return o
}
func (o InstanceTemplatePtrOutput) Elem() InstanceTemplateOutput {
return o.ApplyT(func(v *InstanceTemplate) InstanceTemplate {
if v != nil {
return *v
}
var ret InstanceTemplate
return ret
}).(InstanceTemplateOutput)
}
type InstanceTemplateArrayOutput struct{ *pulumi.OutputState }
func (InstanceTemplateArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]InstanceTemplate)(nil))
}
func (o InstanceTemplateArrayOutput) ToInstanceTemplateArrayOutput() InstanceTemplateArrayOutput {
return o
}
func (o InstanceTemplateArrayOutput) ToInstanceTemplateArrayOutputWithContext(ctx context.Context) InstanceTemplateArrayOutput {
return o
}
func (o InstanceTemplateArrayOutput) Index(i pulumi.IntInput) InstanceTemplateOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) InstanceTemplate {
return vs[0].([]InstanceTemplate)[vs[1].(int)]
}).(InstanceTemplateOutput)
}
type InstanceTemplateMapOutput struct{ *pulumi.OutputState }
func (InstanceTemplateMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]InstanceTemplate)(nil))
}
func (o InstanceTemplateMapOutput) ToInstanceTemplateMapOutput() InstanceTemplateMapOutput {
return o
}
func (o InstanceTemplateMapOutput) ToInstanceTemplateMapOutputWithContext(ctx context.Context) InstanceTemplateMapOutput {
return o
}
func (o InstanceTemplateMapOutput) MapIndex(k pulumi.StringInput) InstanceTemplateOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) InstanceTemplate {
return vs[0].(map[string]InstanceTemplate)[vs[1].(string)]
}).(InstanceTemplateOutput)
}
func init() {
pulumi.RegisterOutputType(InstanceTemplateOutput{})
pulumi.RegisterOutputType(InstanceTemplatePtrOutput{})
pulumi.RegisterOutputType(InstanceTemplateArrayOutput{})
pulumi.RegisterOutputType(InstanceTemplateMapOutput{})
}