Instance class

Manages a VM instance resource within GCE. For more information see the official documentation and API.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = new gcp.serviceaccount.Account("default", {
    accountId: "my-custom-sa",
    displayName: "Custom SA for VM Instance",
});
const defaultInstance = new gcp.compute.Instance("default", {
    networkInterfaces: [{
        accessConfigs: [{}],
        network: "default",
    }],
    name: "my-instance",
    machineType: "n2-standard-2",
    zone: "us-central1-a",
    tags: [
        "foo",
        "bar",
    ],
    bootDisk: {
        initializeParams: {
            image: "debian-cloud/debian-11",
            labels: {
                my_label: "value",
            },
        },
    },
    scratchDisks: [{
        "interface": "NVME",
    }],
    metadata: {
        foo: "bar",
    },
    metadataStartupScript: "echo hi > /test.txt",
    serviceAccount: {
        email: _default.email,
        scopes: ["cloud-platform"],
    },
});
import pulumi
import pulumi_gcp as gcp

default = gcp.serviceaccount.Account("default",
    account_id="my-custom-sa",
    display_name="Custom SA for VM Instance")
default_instance = gcp.compute.Instance("default",
    network_interfaces=[{
        "access_configs": [{}],
        "network": "default",
    }],
    name="my-instance",
    machine_type="n2-standard-2",
    zone="us-central1-a",
    tags=[
        "foo",
        "bar",
    ],
    boot_disk={
        "initialize_params": {
            "image": "debian-cloud/debian-11",
            "labels": {
                "my_label": "value",
            },
        },
    },
    scratch_disks=[{
        "interface": "NVME",
    }],
    metadata={
        "foo": "bar",
    },
    metadata_startup_script="echo hi > /test.txt",
    service_account={
        "email": default.email,
        "scopes": ["cloud-platform"],
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = new Gcp.ServiceAccount.Account("default", new()
    {
        AccountId = "my-custom-sa",
        DisplayName = "Custom SA for VM Instance",
    });

    var defaultInstance = new Gcp.Compute.Instance("default", new()
    {
        NetworkInterfaces = new[]
        {
            new Gcp.Compute.Inputs.InstanceNetworkInterfaceArgs
            {
                AccessConfigs = new[]
                {
                    null,
                },
                Network = "default",
            },
        },
        Name = "my-instance",
        MachineType = "n2-standard-2",
        Zone = "us-central1-a",
        Tags = new[]
        {
            "foo",
            "bar",
        },
        BootDisk = new Gcp.Compute.Inputs.InstanceBootDiskArgs
        {
            InitializeParams = new Gcp.Compute.Inputs.InstanceBootDiskInitializeParamsArgs
            {
                Image = "debian-cloud/debian-11",
                Labels =
                {
                    { "my_label", "value" },
                },
            },
        },
        ScratchDisks = new[]
        {
            new Gcp.Compute.Inputs.InstanceScratchDiskArgs
            {
                Interface = "NVME",
            },
        },
        Metadata =
        {
            { "foo", "bar" },
        },
        MetadataStartupScript = "echo hi > /test.txt",
        ServiceAccount = new Gcp.Compute.Inputs.InstanceServiceAccountArgs
        {
            Email = @default.Email,
            Scopes = new[]
            {
                "cloud-platform",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/serviceaccount"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := serviceaccount.NewAccount(ctx, "default", &serviceaccount.AccountArgs{
			AccountId:   pulumi.String("my-custom-sa"),
			DisplayName: pulumi.String("Custom SA for VM Instance"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewInstance(ctx, "default", &compute.InstanceArgs{
			NetworkInterfaces: compute.InstanceNetworkInterfaceArray{
				&compute.InstanceNetworkInterfaceArgs{
					AccessConfigs: compute.InstanceNetworkInterfaceAccessConfigArray{
						&compute.InstanceNetworkInterfaceAccessConfigArgs{},
					},
					Network: pulumi.String("default"),
				},
			},
			Name:        pulumi.String("my-instance"),
			MachineType: pulumi.String("n2-standard-2"),
			Zone:        pulumi.String("us-central1-a"),
			Tags: pulumi.StringArray{
				pulumi.String("foo"),
				pulumi.String("bar"),
			},
			BootDisk: &compute.InstanceBootDiskArgs{
				InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
					Image: pulumi.String("debian-cloud/debian-11"),
					Labels: pulumi.StringMap{
						"my_label": pulumi.String("value"),
					},
				},
			},
			ScratchDisks: compute.InstanceScratchDiskArray{
				&compute.InstanceScratchDiskArgs{
					Interface: pulumi.String("NVME"),
				},
			},
			Metadata: pulumi.StringMap{
				"foo": pulumi.String("bar"),
			},
			MetadataStartupScript: pulumi.String("echo hi > /test.txt"),
			ServiceAccount: &compute.InstanceServiceAccountArgs{
				Email: _default.Email,
				Scopes: pulumi.StringArray{
					pulumi.String("cloud-platform"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_serviceaccount_account" "default" {
  account_id   = "my-custom-sa"
  display_name = "Custom SA for VM Instance"
}
resource "gcp_compute_instance" "default" {
  network_interfaces {
    access_configs {
    }
    network = "default"
  }
  name         = "my-instance"
  machine_type = "n2-standard-2"
  zone         = "us-central1-a"
  tags         = ["foo", "bar"]
  boot_disk = {
    initialize_params = {
      image = "debian-cloud/debian-11"
      labels = {
        "my_label" = "value"
      }
    }
  }
  scratch_disks {
    interface = "NVME"
  }
  metadata = {
    "foo" = "bar"
  }
  metadata_startup_script = "echo hi > /test.txt"
  service_account = {
    email  = gcp_serviceaccount_account.default.email
    scopes = ["cloud-platform"]
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.serviceaccount.Account;
import com.pulumi.gcp.serviceaccount.AccountArgs;
import com.pulumi.gcp.compute.Instance;
import com.pulumi.gcp.compute.InstanceArgs;
import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceArgs;
import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceAccessConfigArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
import com.pulumi.gcp.compute.inputs.InstanceScratchDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceServiceAccountArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 default_ = new Account("default", AccountArgs.builder()
            .accountId("my-custom-sa")
            .displayName("Custom SA for VM Instance")
            .build());

        var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
            .networkInterfaces(InstanceNetworkInterfaceArgs.builder()
                .accessConfigs(InstanceNetworkInterfaceAccessConfigArgs.builder()
                    .build())
                .network("default")
                .build())
            .name("my-instance")
            .machineType("n2-standard-2")
            .zone("us-central1-a")
            .tags(
                "foo",
                "bar")
            .bootDisk(InstanceBootDiskArgs.builder()
                .initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
                    .image("debian-cloud/debian-11")
                    .labels(Map.of("my_label", "value"))
                    .build())
                .build())
            .scratchDisks(InstanceScratchDiskArgs.builder()
                .interface_("NVME")
                .build())
            .metadata(Map.of("foo", "bar"))
            .metadataStartupScript("echo hi > /test.txt")
            .serviceAccount(InstanceServiceAccountArgs.builder()
                .email(default_.email())
                .scopes("cloud-platform")
                .build())
            .build());

    }
}
resources:
  default:
    type: gcp:serviceaccount:Account
    properties:
      accountId: my-custom-sa
      displayName: Custom SA for VM Instance
  defaultInstance:
    type: gcp:compute:Instance
    name: default
    properties:
      networkInterfaces:
        - accessConfigs:
            - {}
          network: default
      name: my-instance
      machineType: n2-standard-2
      zone: us-central1-a
      tags:
        - foo
        - bar
      bootDisk:
        initializeParams:
          image: debian-cloud/debian-11
          labels:
            my_label: value
      scratchDisks:
        - interface: NVME
      metadata:
        foo: bar
      metadataStartupScript: echo hi > /test.txt
      serviceAccount:
        email: ${default.email}
        scopes:
          - cloud-platform

Confidential Computing

Example with Confidential Mode activated.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = new gcp.serviceaccount.Account("default", {
    accountId: "my-custom-sa",
    displayName: "Custom SA for VM Instance",
});
const confidentialInstance = new gcp.compute.Instance("confidential_instance", {
    networkInterfaces: [{
        accessConfigs: [{}],
        network: "default",
    }],
    name: "my-confidential-instance",
    zone: "us-central1-a",
    machineType: "n2d-standard-2",
    minCpuPlatform: "AMD Milan",
    confidentialInstanceConfig: {
        enableConfidentialCompute: true,
        confidentialInstanceType: "SEV",
    },
    bootDisk: {
        initializeParams: {
            image: "ubuntu-os-cloud/ubuntu-2204-lts",
            labels: {
                my_label: "value",
            },
        },
    },
    scratchDisks: [{
        "interface": "NVME",
    }],
    serviceAccount: {
        email: _default.email,
        scopes: ["cloud-platform"],
    },
});
import pulumi
import pulumi_gcp as gcp

default = gcp.serviceaccount.Account("default",
    account_id="my-custom-sa",
    display_name="Custom SA for VM Instance")
confidential_instance = gcp.compute.Instance("confidential_instance",
    network_interfaces=[{
        "access_configs": [{}],
        "network": "default",
    }],
    name="my-confidential-instance",
    zone="us-central1-a",
    machine_type="n2d-standard-2",
    min_cpu_platform="AMD Milan",
    confidential_instance_config={
        "enable_confidential_compute": True,
        "confidential_instance_type": "SEV",
    },
    boot_disk={
        "initialize_params": {
            "image": "ubuntu-os-cloud/ubuntu-2204-lts",
            "labels": {
                "my_label": "value",
            },
        },
    },
    scratch_disks=[{
        "interface": "NVME",
    }],
    service_account={
        "email": default.email,
        "scopes": ["cloud-platform"],
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = new Gcp.ServiceAccount.Account("default", new()
    {
        AccountId = "my-custom-sa",
        DisplayName = "Custom SA for VM Instance",
    });

    var confidentialInstance = new Gcp.Compute.Instance("confidential_instance", new()
    {
        NetworkInterfaces = new[]
        {
            new Gcp.Compute.Inputs.InstanceNetworkInterfaceArgs
            {
                AccessConfigs = new[]
                {
                    null,
                },
                Network = "default",
            },
        },
        Name = "my-confidential-instance",
        Zone = "us-central1-a",
        MachineType = "n2d-standard-2",
        MinCpuPlatform = "AMD Milan",
        ConfidentialInstanceConfig = new Gcp.Compute.Inputs.InstanceConfidentialInstanceConfigArgs
        {
            EnableConfidentialCompute = true,
            ConfidentialInstanceType = "SEV",
        },
        BootDisk = new Gcp.Compute.Inputs.InstanceBootDiskArgs
        {
            InitializeParams = new Gcp.Compute.Inputs.InstanceBootDiskInitializeParamsArgs
            {
                Image = "ubuntu-os-cloud/ubuntu-2204-lts",
                Labels =
                {
                    { "my_label", "value" },
                },
            },
        },
        ScratchDisks = new[]
        {
            new Gcp.Compute.Inputs.InstanceScratchDiskArgs
            {
                Interface = "NVME",
            },
        },
        ServiceAccount = new Gcp.Compute.Inputs.InstanceServiceAccountArgs
        {
            Email = @default.Email,
            Scopes = new[]
            {
                "cloud-platform",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/serviceaccount"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := serviceaccount.NewAccount(ctx, "default", &serviceaccount.AccountArgs{
			AccountId:   pulumi.String("my-custom-sa"),
			DisplayName: pulumi.String("Custom SA for VM Instance"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewInstance(ctx, "confidential_instance", &compute.InstanceArgs{
			NetworkInterfaces: compute.InstanceNetworkInterfaceArray{
				&compute.InstanceNetworkInterfaceArgs{
					AccessConfigs: compute.InstanceNetworkInterfaceAccessConfigArray{
						&compute.InstanceNetworkInterfaceAccessConfigArgs{},
					},
					Network: pulumi.String("default"),
				},
			},
			Name:           pulumi.String("my-confidential-instance"),
			Zone:           pulumi.String("us-central1-a"),
			MachineType:    pulumi.String("n2d-standard-2"),
			MinCpuPlatform: pulumi.String("AMD Milan"),
			ConfidentialInstanceConfig: &compute.InstanceConfidentialInstanceConfigArgs{
				EnableConfidentialCompute: pulumi.Bool(true),
				ConfidentialInstanceType:  pulumi.String("SEV"),
			},
			BootDisk: &compute.InstanceBootDiskArgs{
				InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
					Image: pulumi.String("ubuntu-os-cloud/ubuntu-2204-lts"),
					Labels: pulumi.StringMap{
						"my_label": pulumi.String("value"),
					},
				},
			},
			ScratchDisks: compute.InstanceScratchDiskArray{
				&compute.InstanceScratchDiskArgs{
					Interface: pulumi.String("NVME"),
				},
			},
			ServiceAccount: &compute.InstanceServiceAccountArgs{
				Email: _default.Email,
				Scopes: pulumi.StringArray{
					pulumi.String("cloud-platform"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_serviceaccount_account" "default" {
  account_id   = "my-custom-sa"
  display_name = "Custom SA for VM Instance"
}
resource "gcp_compute_instance" "confidential_instance" {
  network_interfaces {
    access_configs {
    }
    network = "default"
  }
  name             = "my-confidential-instance"
  zone             = "us-central1-a"
  machine_type     = "n2d-standard-2"
  min_cpu_platform = "AMD Milan"
  confidential_instance_config = {
    enable_confidential_compute = true
    confidential_instance_type  = "SEV"
  }
  boot_disk = {
    initialize_params = {
      image = "ubuntu-os-cloud/ubuntu-2204-lts"
      labels = {
        "my_label" = "value"
      }
    }
  }
  scratch_disks {
    interface = "NVME"
  }
  service_account = {
    email  = gcp_serviceaccount_account.default.email
    scopes = ["cloud-platform"]
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.serviceaccount.Account;
import com.pulumi.gcp.serviceaccount.AccountArgs;
import com.pulumi.gcp.compute.Instance;
import com.pulumi.gcp.compute.InstanceArgs;
import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceArgs;
import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceAccessConfigArgs;
import com.pulumi.gcp.compute.inputs.InstanceConfidentialInstanceConfigArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
import com.pulumi.gcp.compute.inputs.InstanceScratchDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceServiceAccountArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 default_ = new Account("default", AccountArgs.builder()
            .accountId("my-custom-sa")
            .displayName("Custom SA for VM Instance")
            .build());

        var confidentialInstance = new Instance("confidentialInstance", InstanceArgs.builder()
            .networkInterfaces(InstanceNetworkInterfaceArgs.builder()
                .accessConfigs(InstanceNetworkInterfaceAccessConfigArgs.builder()
                    .build())
                .network("default")
                .build())
            .name("my-confidential-instance")
            .zone("us-central1-a")
            .machineType("n2d-standard-2")
            .minCpuPlatform("AMD Milan")
            .confidentialInstanceConfig(InstanceConfidentialInstanceConfigArgs.builder()
                .enableConfidentialCompute(true)
                .confidentialInstanceType("SEV")
                .build())
            .bootDisk(InstanceBootDiskArgs.builder()
                .initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
                    .image("ubuntu-os-cloud/ubuntu-2204-lts")
                    .labels(Map.of("my_label", "value"))
                    .build())
                .build())
            .scratchDisks(InstanceScratchDiskArgs.builder()
                .interface_("NVME")
                .build())
            .serviceAccount(InstanceServiceAccountArgs.builder()
                .email(default_.email())
                .scopes("cloud-platform")
                .build())
            .build());

    }
}
resources:
  default:
    type: gcp:serviceaccount:Account
    properties:
      accountId: my-custom-sa
      displayName: Custom SA for VM Instance
  confidentialInstance:
    type: gcp:compute:Instance
    name: confidential_instance
    properties:
      networkInterfaces:
        - accessConfigs:
            - {}
          network: default
      name: my-confidential-instance
      zone: us-central1-a
      machineType: n2d-standard-2
      minCpuPlatform: AMD Milan
      confidentialInstanceConfig:
        enableConfidentialCompute: true
        confidentialInstanceType: SEV
      bootDisk:
        initializeParams:
          image: ubuntu-os-cloud/ubuntu-2204-lts
          labels:
            my_label: value
      scratchDisks:
        - interface: NVME
      serviceAccount:
        email: ${default.email}
        scopes:
          - cloud-platform

Import

> Note: The fields boot_disk.0.disk_encryption_raw and attached_disk.*.disk_encryption_key_raw cannot be imported automatically. The API doesn't return this information. If you are setting one of these fields in your config, you will need to update your state manually after importing the resource.

> Note: The desiredStatus field will not be set on import. If you have it set, Terraform will update the field on the next pulumi up, bringing your instance to the desired status.

Instances can be imported using any of these accepted formats:

  • projects/{{project}}/zones/{{zone}}/instances/{{name}}
  • {{project}}/{{zone}}/{{name}}
  • {{name}}

When using the pulumi import command, instances can be imported using one of the formats above. For example:

$ pulumi import gcp:compute/instance:Instance default projects/{{project}}/zones/{{zone}}/instances/{{name}}
$ pulumi import gcp:compute/instance:Instance default {{project}}/{{zone}}/{{name}}
$ pulumi import gcp:compute/instance:Instance default {{name}}

Constructors

Instance(String name, {InstanceArgs? args, CustomResourceOptions? options})
Creates a new Instance. name The Pulumi resource name. args Arguments used to configure this Instance. The set of arguments for Instance. options Resource options controlling this resource's behavior.
Instance.reference(String urn)
Creates a typed reference to an existing Instance resource.

Properties

advancedMachineFeatures ↔ Output<InstanceAdvancedMachineFeatures?>
Configure Nested Virtualisation and Simultaneous Hyper Threading on this VM. Structure is documented below
latefinal
allowStoppingForUpdate ↔ Output<bool?>
If true, allows this provider to stop the instance to update its properties. If you try to update a property that requires stopping the instance without setting this field, the update will fail.
latefinal
attachedDisks ↔ Output<List<InstanceAttachedDisk>?>
Additional disks to attach to the instance. Can be repeated multiple times for multiple disks. Structure is documented below.
latefinal
bootDisk ↔ Output<InstanceBootDisk>
The boot disk for the instance. Structure is documented below.
latefinal
canIpForward ↔ Output<bool?>
Whether to allow sending and receiving of packets with non-matching source or destination IPs. This defaults to false.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
confidentialInstanceConfig ↔ Output<InstanceConfidentialInstanceConfig>
Enable Confidential Mode on this VM. Structure is documented below
latefinal
cpuPlatform ↔ Output<String>
The CPU platform used by this instance.
latefinal
creationTimestamp ↔ Output<String>
Creation timestamp in RFC3339 text format.
latefinal
currentStatus ↔ Output<String>
The current status of the instance. This could be one of the following values: PROVISIONING, STAGING, RUNNING, STOPPING, SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. For more information about the status of the instance, see Instance life cycle.
latefinal
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to "DELETE". When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
deletionProtection ↔ Output<bool?>
Enable deletion protection on this instance. Defaults to false. Note: you must disable deletion protection before removing the resource (e.g., via pulumi destroy), or the instance cannot be deleted and the provider run will not complete successfully.
latefinal
description ↔ Output<String?>
A brief description of this resource.
latefinal
desiredStatus ↔ Output<String?>
Desired status of the instance. Either "RUNNING", "SUSPENDED" or "TERMINATED".
latefinal
effectiveLabels ↔ Output<Map<String, String>>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
latefinal
enableDisplay ↔ Output<bool?>
Enable Virtual Displays on this instance. Note: allowStoppingForUpdate must be set to true or your instance must have a desiredStatus of TERMINATED in order to update this field.
latefinal
eraseWindowsVssSignature ↔ Output<bool?>
Beta Specifies whether the disks restored from source snapshots or source machine image should erase Windows specific VSS signature.
latefinal
guestAccelerators ↔ Output<List<InstanceGuestAccelerator>>
List of the type and count of accelerator cards attached to the instance. Structure documented below. Note: GPU accelerators can only be used with onHostMaintenance option set to TERMINATE.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
hostname ↔ Output<String?>
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.
latefinal
id ↔ Output<String>
getter/setter pairinherited
instanceEncryptionKey ↔ Output<InstanceInstanceEncryptionKey?>
Configuration for data encryption on the instance with encryption keys. Structure is documented below.
latefinal
instanceId ↔ Output<String>
The server-assigned unique identifier of this instance.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
keyRevocationActionType ↔ Output<String?>
Action to be taken when a customer's encryption key is revoked. Supports STOP and NONE, with NONE being the default.
latefinal
labelFingerprint ↔ Output<String>
The unique fingerprint of the labels.
latefinal
labels ↔ Output<Map<String, String>?>
A map of key/value label pairs to assign 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.
latefinal
machineType ↔ Output<String>
The machine type to create.
latefinal
metadata ↔ Output<Map<String, String>?>
Metadata key/value pairs to make available from within the instance. Ssh keys attached in the Cloud Console will be removed. Add them to your config in order to keep them attached to your instance. A list of predefined metadata keys (e.g. ssh-keys) can be found here
latefinal
metadataFingerprint ↔ Output<String>
The unique fingerprint of the metadata.
latefinal
metadataStartupScript ↔ Output<String?>
An alternative to using the startup-script metadata key, except this one forces the instance to be recreated (thus re-running the script) if it is changed. This replaces the startup-script metadata key on the created instance and thus the two mechanisms are not allowed to be used simultaneously. Users are free to use either mechanism - the only distinction is that this separate attribute will cause a recreate on modification. On import, metadataStartupScript will not be set - if you choose to specify it you will see a diff immediately after import causing a destroy/recreate operation. If importing an instance and specifying this value is desired, you will need to modify your state file.
latefinal
minCpuPlatform ↔ Output<String>
Specifies a minimum CPU platform for the VM instance. Applicable values are the friendly names of CPU platforms, such as Intel Haswell or Intel Skylake. See the complete list here. Note: allowStoppingForUpdate must be set to true or your instance must have a desiredStatus of TERMINATED in order to update this field.
latefinal
name ↔ Output<String>
A unique name for the resource, required by GCE. Changing this forces a new resource to be created.
latefinal
networkInterfaces ↔ Output<List<InstanceNetworkInterface>>
Networks to attach to the instance. This can be specified multiple times. Structure is documented below.
latefinal
networkPerformanceConfig ↔ Output<InstanceNetworkPerformanceConfig?>
Configures network performance settings for the instance. Structure is documented below. Note: machineType must be a supported type, the image used must include the GVNIC in guest-os-features, and network_interface.0.nic-type must be GVNIC in order for this setting to take effect.
latefinal
params ↔ Output<InstanceParams?>
Additional instance parameters. .
latefinal
partnerMetadata ↔ Output<Map<String, String>?>
Beta key/value pair represents partner metadata assigned to instance where key represent a defined namespace and value is a json string represent the entries associted with the namespace.
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
pulumiLabels ↔ Output<Map<String, String>>
The combination of labels configured directly on the resource and default labels configured on the provider.
latefinal
reservationAffinity ↔ Output<InstanceReservationAffinity>
Specifies the reservations that this instance can consume from. Structure is documented below.
latefinal
resourcePolicies ↔ Output<String?>
  • A list of selfLinks of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported.
  • latefinal
    resourceTransforms → List<ResourceTransform>
    Inherited/explicit async transforms.
    no setterinherited
    runtimeType → Type
    A representation of the runtime type of the object.
    no setterinherited
    scheduling ↔ Output<InstanceScheduling>
    The scheduling strategy to use. More details about this configuration option are detailed below.
    latefinal
    scratchDisks ↔ Output<List<InstanceScratchDisk>?>
    Scratch disks to attach to the instance. This can be specified multiple times for multiple scratch disks. Structure is documented below.
    latefinal
    The URI of the created resource.
    latefinal
    serviceAccount ↔ Output<InstanceServiceAccount?>
    Service account to attach to the instance. Structure is documented below. Note: allowStoppingForUpdate must be set to true or your instance must have a desiredStatus of TERMINATED in order to update this field.
    latefinal
    shieldedInstanceConfig ↔ Output<InstanceShieldedInstanceConfig>
    Enable 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. Note: allowStoppingForUpdate must be set to true or your instance must have a desiredStatus of TERMINATED in order to update this field.
    latefinal
    tags ↔ Output<List<String>?>
    A list of network tags to attach to the instance.
    latefinal
    tagsFingerprint ↔ Output<String>
    The unique fingerprint of the tags.
    latefinal
    transformations → List<ResourceTransformation>
    Inherited/explicit legacy transformations.
    no setterinherited
    urn ↔ Output<String>
    latefinalinherited
    workloadIdentityConfig ↔ Output<InstanceWorkloadIdentityConfig?>
    Workload Identity Config. More details about this configuration option are detailed below.
    latefinal
    zone ↔ Output<String>
    The zone that the machine should be created in. If it is not provided, the provider zone is used.
    latefinal

    Methods

    failId(Object error) → void
    Completes this resource ID with an error when registration fails.
    inherited
    failOutputs(Object error) → void
    Completes all output properties with error.
    inherited
    failUrn(Object error) → void
    Completes this resource URN with an error when registration fails.
    inherited
    getProvider(String moduleMember) → ProviderResource?
    Returns provider for moduleMember's package, if configured.
    inherited
    getResourceName() → String
    Returns this resource's logical name.
    inherited
    getResourceType() → String
    Returns this resource's Pulumi type token.
    inherited
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
    Registers a dynamic output property for this resource.
    inherited
    resolveId(String? value, {required bool isKnown}) → void
    Resolves the provider-assigned ID for this resource.
    inherited
    resolveOutputs(Struct outputs) → void
    Resolves all output properties from a monitor response payload.
    inherited
    resolveUrn(String value) → void
    Resolves this resource's URN once assigned by the engine.
    inherited
    serializeProperties(Map<String, dynamic> properties) → Future<Struct>
    Serializes resource properties for RPC transmission.
    inherited
    toString() → String
    A string representation of this object.
    inherited

    Operators

    operator ==(Object other) → bool
    The equality operator.
    inherited

    Static Methods

    get(String name, Input<String> id, {InstanceState? state, CustomResourceOptions? options}) → Instance
    Gets an existing Instance resource's state with the given name and id.