InstanceFromTemplateArgs

data class InstanceFromTemplateArgs(val advancedMachineFeatures: Output<InstanceFromTemplateAdvancedMachineFeaturesArgs>? = null, val allowStoppingForUpdate: Output<Boolean>? = null, val attachedDisks: Output<List<InstanceFromTemplateAttachedDiskArgs>>? = null, val bootDisk: Output<InstanceFromTemplateBootDiskArgs>? = null, val canIpForward: Output<Boolean>? = null, val confidentialInstanceConfig: Output<InstanceFromTemplateConfidentialInstanceConfigArgs>? = null, val deletionProtection: Output<Boolean>? = null, val description: Output<String>? = null, val desiredStatus: Output<String>? = null, val enableDisplay: Output<Boolean>? = null, val guestAccelerators: Output<List<InstanceFromTemplateGuestAcceleratorArgs>>? = null, val hostname: Output<String>? = null, val instanceEncryptionKey: Output<InstanceFromTemplateInstanceEncryptionKeyArgs>? = null, val keyRevocationActionType: Output<String>? = null, val labels: Output<Map<String, String>>? = null, val machineType: Output<String>? = null, val metadata: Output<Map<String, String>>? = null, val metadataStartupScript: Output<String>? = null, val minCpuPlatform: Output<String>? = null, val name: Output<String>? = null, val networkInterfaces: Output<List<InstanceFromTemplateNetworkInterfaceArgs>>? = null, val networkPerformanceConfig: Output<InstanceFromTemplateNetworkPerformanceConfigArgs>? = null, val params: Output<InstanceFromTemplateParamsArgs>? = null, val partnerMetadata: Output<Map<String, String>>? = null, val project: Output<String>? = null, val reservationAffinity: Output<InstanceFromTemplateReservationAffinityArgs>? = null, val resourcePolicies: Output<String>? = null, val scheduling: Output<InstanceFromTemplateSchedulingArgs>? = null, val scratchDisks: Output<List<InstanceFromTemplateScratchDiskArgs>>? = null, val serviceAccount: Output<InstanceFromTemplateServiceAccountArgs>? = null, val shieldedInstanceConfig: Output<InstanceFromTemplateShieldedInstanceConfigArgs>? = null, val sourceInstanceTemplate: Output<String>? = null, val tags: Output<List<String>>? = null, val zone: Output<String>? = null) : ConvertibleToJava<InstanceFromTemplateArgs>

Manages a VM instance resource within GCE. For more information see the official documentation and API. This resource is specifically to create a compute instance from a given source_instance_template. To create an instance without a template, use the gcp.compute.Instance resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const tpl = new gcp.compute.InstanceTemplate("tpl", {
name: "template",
machineType: "e2-medium",
disks: [{
sourceImage: "debian-cloud/debian-11",
autoDelete: true,
diskSizeGb: 100,
boot: true,
}],
networkInterfaces: [{
network: "default",
}],
metadata: {
foo: "bar",
},
canIpForward: true,
});
const tplInstanceFromTemplate = new gcp.compute.InstanceFromTemplate("tpl", {
name: "instance-from-template",
zone: "us-central1-a",
sourceInstanceTemplate: tpl.selfLinkUnique,
canIpForward: false,
labels: {
my_key: "my_value",
},
});
import pulumi
import pulumi_gcp as gcp
tpl = gcp.compute.InstanceTemplate("tpl",
name="template",
machine_type="e2-medium",
disks=[{
"source_image": "debian-cloud/debian-11",
"auto_delete": True,
"disk_size_gb": 100,
"boot": True,
}],
network_interfaces=[{
"network": "default",
}],
metadata={
"foo": "bar",
},
can_ip_forward=True)
tpl_instance_from_template = gcp.compute.InstanceFromTemplate("tpl",
name="instance-from-template",
zone="us-central1-a",
source_instance_template=tpl.self_link_unique,
can_ip_forward=False,
labels={
"my_key": "my_value",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var tpl = new Gcp.Compute.InstanceTemplate("tpl", new()
{
Name = "template",
MachineType = "e2-medium",
Disks = new[]
{
new Gcp.Compute.Inputs.InstanceTemplateDiskArgs
{
SourceImage = "debian-cloud/debian-11",
AutoDelete = true,
DiskSizeGb = 100,
Boot = true,
},
},
NetworkInterfaces = new[]
{
new Gcp.Compute.Inputs.InstanceTemplateNetworkInterfaceArgs
{
Network = "default",
},
},
Metadata =
{
{ "foo", "bar" },
},
CanIpForward = true,
});
var tplInstanceFromTemplate = new Gcp.Compute.InstanceFromTemplate("tpl", new()
{
Name = "instance-from-template",
Zone = "us-central1-a",
SourceInstanceTemplate = tpl.SelfLinkUnique,
CanIpForward = false,
Labels =
{
{ "my_key", "my_value" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tpl, err := compute.NewInstanceTemplate(ctx, "tpl", &compute.InstanceTemplateArgs{
Name: pulumi.String("template"),
MachineType: pulumi.String("e2-medium"),
Disks: compute.InstanceTemplateDiskArray{
&compute.InstanceTemplateDiskArgs{
SourceImage: pulumi.String("debian-cloud/debian-11"),
AutoDelete: pulumi.Bool(true),
DiskSizeGb: pulumi.Int(100),
Boot: pulumi.Bool(true),
},
},
NetworkInterfaces: compute.InstanceTemplateNetworkInterfaceArray{
&compute.InstanceTemplateNetworkInterfaceArgs{
Network: pulumi.String("default"),
},
},
Metadata: pulumi.StringMap{
"foo": pulumi.String("bar"),
},
CanIpForward: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = compute.NewInstanceFromTemplate(ctx, "tpl", &compute.InstanceFromTemplateArgs{
Name: pulumi.String("instance-from-template"),
Zone: pulumi.String("us-central1-a"),
SourceInstanceTemplate: tpl.SelfLinkUnique,
CanIpForward: pulumi.Bool(false),
Labels: pulumi.StringMap{
"my_key": pulumi.String("my_value"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.InstanceTemplate;
import com.pulumi.gcp.compute.InstanceTemplateArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateNetworkInterfaceArgs;
import com.pulumi.gcp.compute.InstanceFromTemplate;
import com.pulumi.gcp.compute.InstanceFromTemplateArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var tpl = new InstanceTemplate("tpl", InstanceTemplateArgs.builder()
.name("template")
.machineType("e2-medium")
.disks(InstanceTemplateDiskArgs.builder()
.sourceImage("debian-cloud/debian-11")
.autoDelete(true)
.diskSizeGb(100)
.boot(true)
.build())
.networkInterfaces(InstanceTemplateNetworkInterfaceArgs.builder()
.network("default")
.build())
.metadata(Map.of("foo", "bar"))
.canIpForward(true)
.build());
var tplInstanceFromTemplate = new InstanceFromTemplate("tplInstanceFromTemplate", InstanceFromTemplateArgs.builder()
.name("instance-from-template")
.zone("us-central1-a")
.sourceInstanceTemplate(tpl.selfLinkUnique())
.canIpForward(false)
.labels(Map.of("my_key", "my_value"))
.build());
}
}
resources:
tpl:
type: gcp:compute:InstanceTemplate
properties:
name: template
machineType: e2-medium
disks:
- sourceImage: debian-cloud/debian-11
autoDelete: true
diskSizeGb: 100
boot: true
networkInterfaces:
- network: default
metadata:
foo: bar
canIpForward: true
tplInstanceFromTemplate:
type: gcp:compute:InstanceFromTemplate
name: tpl
properties:
name: instance-from-template
zone: us-central1-a
sourceInstanceTemplate: ${tpl.selfLinkUnique}
canIpForward: false
labels:
my_key: my_value

Import

This resource does not support import.

Constructors

Link copied to clipboard
constructor(advancedMachineFeatures: Output<InstanceFromTemplateAdvancedMachineFeaturesArgs>? = null, allowStoppingForUpdate: Output<Boolean>? = null, attachedDisks: Output<List<InstanceFromTemplateAttachedDiskArgs>>? = null, bootDisk: Output<InstanceFromTemplateBootDiskArgs>? = null, canIpForward: Output<Boolean>? = null, confidentialInstanceConfig: Output<InstanceFromTemplateConfidentialInstanceConfigArgs>? = null, deletionProtection: Output<Boolean>? = null, description: Output<String>? = null, desiredStatus: Output<String>? = null, enableDisplay: Output<Boolean>? = null, guestAccelerators: Output<List<InstanceFromTemplateGuestAcceleratorArgs>>? = null, hostname: Output<String>? = null, instanceEncryptionKey: Output<InstanceFromTemplateInstanceEncryptionKeyArgs>? = null, keyRevocationActionType: Output<String>? = null, labels: Output<Map<String, String>>? = null, machineType: Output<String>? = null, metadata: Output<Map<String, String>>? = null, metadataStartupScript: Output<String>? = null, minCpuPlatform: Output<String>? = null, name: Output<String>? = null, networkInterfaces: Output<List<InstanceFromTemplateNetworkInterfaceArgs>>? = null, networkPerformanceConfig: Output<InstanceFromTemplateNetworkPerformanceConfigArgs>? = null, params: Output<InstanceFromTemplateParamsArgs>? = null, partnerMetadata: Output<Map<String, String>>? = null, project: Output<String>? = null, reservationAffinity: Output<InstanceFromTemplateReservationAffinityArgs>? = null, resourcePolicies: Output<String>? = null, scheduling: Output<InstanceFromTemplateSchedulingArgs>? = null, scratchDisks: Output<List<InstanceFromTemplateScratchDiskArgs>>? = null, serviceAccount: Output<InstanceFromTemplateServiceAccountArgs>? = null, shieldedInstanceConfig: Output<InstanceFromTemplateShieldedInstanceConfigArgs>? = null, sourceInstanceTemplate: Output<String>? = null, tags: Output<List<String>>? = null, zone: Output<String>? = null)

Properties

Link copied to clipboard

Controls for advanced machine-related behavior features.

Link copied to clipboard
val allowStoppingForUpdate: Output<Boolean>? = null
Link copied to clipboard

List of disks attached to the instance

Link copied to clipboard

The boot disk for the instance.

Link copied to clipboard
val canIpForward: Output<Boolean>? = null

Whether sending and receiving of packets with non-matching source or destination IPs is allowed.

Link copied to clipboard

The Confidential VM config being used by the instance. on_host_maintenance has to be set to TERMINATE or this will fail to create.

Link copied to clipboard
val deletionProtection: Output<Boolean>? = null

Whether deletion protection is enabled on this instance.

Link copied to clipboard
val description: Output<String>? = null

A brief description of the resource.

Link copied to clipboard
val desiredStatus: Output<String>? = null

Desired status of the instance. Either "RUNNING", "SUSPENDED" or "TERMINATED".

Link copied to clipboard
val enableDisplay: Output<Boolean>? = null

Whether the instance has virtual displays enabled.

Link copied to clipboard

List of the type and count of accelerator cards attached to the instance.

Link copied to clipboard
val hostname: Output<String>? = null

A custom hostname for the instance. Must be a fully qualified DNS name and RFC-1035-valid. Valid format is a series of labels 1-63 characters long matching the regular expression a-z, concatenated with periods. The entire hostname must not exceed 253 characters. Changing this forces a new resource to be created.

Link copied to clipboard

Encryption key used to provide data encryption on the given instance.

Link copied to clipboard
val keyRevocationActionType: Output<String>? = null

Action to be taken when a customer's encryption key is revoked. Supports "STOP" and "NONE", with "NONE" being the default.

Link copied to clipboard
val labels: Output<Map<String, String>>? = null

A set of key/value label pairs assigned to the instance. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.

Link copied to clipboard
val machineType: Output<String>? = null

The machine type to create.

Link copied to clipboard
val metadata: Output<Map<String, String>>? = null

Metadata key/value pairs made available within the instance.

Link copied to clipboard
val metadataStartupScript: Output<String>? = null

Metadata startup scripts made available within the instance.

Link copied to clipboard
val minCpuPlatform: Output<String>? = null

The minimum CPU platform specified for the VM instance.

Link copied to clipboard
val name: Output<String>? = null

A unique name for the resource, required by GCE. Changing this forces a new resource to be created.

Link copied to clipboard

The networks attached to the instance.

Link copied to clipboard

Configures network performance settings for the instance. If not specified, the instance will be created with its default network performance configuration.

Link copied to clipboard

Stores additional params passed with the request, but not persisted as part of resource payload.

Link copied to clipboard
val partnerMetadata: Output<Map<String, String>>? = null

Partner Metadata Map made available within the instance.

Link copied to clipboard
val project: Output<String>? = null

The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.

Link copied to clipboard

Specifies the reservations that this instance can consume from.

Link copied to clipboard
val resourcePolicies: Output<String>? = null

A list of self_links of resource policies to attach to the instance. Currently a max of 1 resource policy is supported.

Link copied to clipboard

The scheduling strategy being used by the instance.

Link copied to clipboard

The scratch disks attached to the instance.

Link copied to clipboard

The service account to attach to the instance.

Link copied to clipboard

The shielded vm config being used by the instance.

Link copied to clipboard
val sourceInstanceTemplate: Output<String>? = null

Name or self link of an instance template to create the instance based on. It is recommended to reference instance templates through their unique id (self_link_unique attribute).

Link copied to clipboard
val tags: Output<List<String>>? = null

The list of tags attached to the instance.

Link copied to clipboard
val zone: Output<String>? = null

The zone that the machine should be created in. If not set, the provider zone is used. In addition to these, all arguments from gcp.compute.Instance are supported as a way to override the properties in the template. All exported attributes from gcp.compute.Instance are likewise exported here.

Functions

Link copied to clipboard
open override fun toJava(): InstanceFromTemplateArgs