1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. AttachedDisk
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

gcp.compute.AttachedDisk

Explore with Pulumi AI

Persistent disks can be attached to a compute instance using the attached_disk section within the compute instance configuration. However there may be situations where managing the attached disks via the compute instance config isn’t preferable or possible, such as attaching dynamic numbers of disks using the count variable.

To get more information about attaching disks, see:

Note: When using gcp.compute.AttachedDisk you must use lifecycle.ignore_changes = ["attached_disk"] on the gcp.compute.Instance resource that has the disks attached. Otherwise the two resources will fight for control of the attached disk block.

Example Usage

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

const defaultInstance = new gcp.compute.Instance("default", {
    name: "attached-disk-instance",
    machineType: "e2-medium",
    zone: "us-west1-a",
    bootDisk: {
        initializeParams: {
            image: "debian-cloud/debian-11",
        },
    },
    networkInterfaces: [{
        network: "default",
    }],
});
const _default = new gcp.compute.AttachedDisk("default", {
    disk: defaultGoogleComputeDisk.id,
    instance: defaultInstance.id,
});
Copy
import pulumi
import pulumi_gcp as gcp

default_instance = gcp.compute.Instance("default",
    name="attached-disk-instance",
    machine_type="e2-medium",
    zone="us-west1-a",
    boot_disk={
        "initialize_params": {
            "image": "debian-cloud/debian-11",
        },
    },
    network_interfaces=[{
        "network": "default",
    }])
default = gcp.compute.AttachedDisk("default",
    disk=default_google_compute_disk["id"],
    instance=default_instance.id)
Copy
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 {
		defaultInstance, err := compute.NewInstance(ctx, "default", &compute.InstanceArgs{
			Name:        pulumi.String("attached-disk-instance"),
			MachineType: pulumi.String("e2-medium"),
			Zone:        pulumi.String("us-west1-a"),
			BootDisk: &compute.InstanceBootDiskArgs{
				InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
					Image: pulumi.String("debian-cloud/debian-11"),
				},
			},
			NetworkInterfaces: compute.InstanceNetworkInterfaceArray{
				&compute.InstanceNetworkInterfaceArgs{
					Network: pulumi.String("default"),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = compute.NewAttachedDisk(ctx, "default", &compute.AttachedDiskArgs{
			Disk:     pulumi.Any(defaultGoogleComputeDisk.Id),
			Instance: defaultInstance.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var defaultInstance = new Gcp.Compute.Instance("default", new()
    {
        Name = "attached-disk-instance",
        MachineType = "e2-medium",
        Zone = "us-west1-a",
        BootDisk = new Gcp.Compute.Inputs.InstanceBootDiskArgs
        {
            InitializeParams = new Gcp.Compute.Inputs.InstanceBootDiskInitializeParamsArgs
            {
                Image = "debian-cloud/debian-11",
            },
        },
        NetworkInterfaces = new[]
        {
            new Gcp.Compute.Inputs.InstanceNetworkInterfaceArgs
            {
                Network = "default",
            },
        },
    });

    var @default = new Gcp.Compute.AttachedDisk("default", new()
    {
        Disk = defaultGoogleComputeDisk.Id,
        Instance = defaultInstance.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Instance;
import com.pulumi.gcp.compute.InstanceArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceArgs;
import com.pulumi.gcp.compute.AttachedDisk;
import com.pulumi.gcp.compute.AttachedDiskArgs;
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 defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
            .name("attached-disk-instance")
            .machineType("e2-medium")
            .zone("us-west1-a")
            .bootDisk(InstanceBootDiskArgs.builder()
                .initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
                    .image("debian-cloud/debian-11")
                    .build())
                .build())
            .networkInterfaces(InstanceNetworkInterfaceArgs.builder()
                .network("default")
                .build())
            .build());

        var default_ = new AttachedDisk("default", AttachedDiskArgs.builder()
            .disk(defaultGoogleComputeDisk.id())
            .instance(defaultInstance.id())
            .build());

    }
}
Copy
resources:
  default:
    type: gcp:compute:AttachedDisk
    properties:
      disk: ${defaultGoogleComputeDisk.id}
      instance: ${defaultInstance.id}
  defaultInstance:
    type: gcp:compute:Instance
    name: default
    properties:
      name: attached-disk-instance
      machineType: e2-medium
      zone: us-west1-a
      bootDisk:
        initializeParams:
          image: debian-cloud/debian-11
      networkInterfaces:
        - network: default
Copy

Create AttachedDisk Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new AttachedDisk(name: string, args: AttachedDiskArgs, opts?: CustomResourceOptions);
@overload
def AttachedDisk(resource_name: str,
                 args: AttachedDiskArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def AttachedDisk(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 disk: Optional[str] = None,
                 instance: Optional[str] = None,
                 device_name: Optional[str] = None,
                 interface: Optional[str] = None,
                 mode: Optional[str] = None,
                 project: Optional[str] = None,
                 zone: Optional[str] = None)
func NewAttachedDisk(ctx *Context, name string, args AttachedDiskArgs, opts ...ResourceOption) (*AttachedDisk, error)
public AttachedDisk(string name, AttachedDiskArgs args, CustomResourceOptions? opts = null)
public AttachedDisk(String name, AttachedDiskArgs args)
public AttachedDisk(String name, AttachedDiskArgs args, CustomResourceOptions options)
type: gcp:compute:AttachedDisk
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AttachedDiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AttachedDiskArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AttachedDiskArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AttachedDiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AttachedDiskArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var attachedDiskResource = new Gcp.Compute.AttachedDisk("attachedDiskResource", new()
{
    Disk = "string",
    Instance = "string",
    DeviceName = "string",
    Interface = "string",
    Mode = "string",
    Project = "string",
    Zone = "string",
});
Copy
example, err := compute.NewAttachedDisk(ctx, "attachedDiskResource", &compute.AttachedDiskArgs{
	Disk:       pulumi.String("string"),
	Instance:   pulumi.String("string"),
	DeviceName: pulumi.String("string"),
	Interface:  pulumi.String("string"),
	Mode:       pulumi.String("string"),
	Project:    pulumi.String("string"),
	Zone:       pulumi.String("string"),
})
Copy
var attachedDiskResource = new AttachedDisk("attachedDiskResource", AttachedDiskArgs.builder()
    .disk("string")
    .instance("string")
    .deviceName("string")
    .interface_("string")
    .mode("string")
    .project("string")
    .zone("string")
    .build());
Copy
attached_disk_resource = gcp.compute.AttachedDisk("attachedDiskResource",
    disk="string",
    instance="string",
    device_name="string",
    interface="string",
    mode="string",
    project="string",
    zone="string")
Copy
const attachedDiskResource = new gcp.compute.AttachedDisk("attachedDiskResource", {
    disk: "string",
    instance: "string",
    deviceName: "string",
    "interface": "string",
    mode: "string",
    project: "string",
    zone: "string",
});
Copy
type: gcp:compute:AttachedDisk
properties:
    deviceName: string
    disk: string
    instance: string
    interface: string
    mode: string
    project: string
    zone: string
Copy

AttachedDisk Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The AttachedDisk resource accepts the following input properties:

Disk
This property is required.
Changes to this property will trigger replacement.
string
name or self_link of the disk that will be attached.


Instance
This property is required.
Changes to this property will trigger replacement.
string
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
DeviceName Changes to this property will trigger replacement. string

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

Interface Changes to this property will trigger replacement. string

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

Mode Changes to this property will trigger replacement. string

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

Project Changes to this property will trigger replacement. string
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
Zone Changes to this property will trigger replacement. string
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
Disk
This property is required.
Changes to this property will trigger replacement.
string
name or self_link of the disk that will be attached.


Instance
This property is required.
Changes to this property will trigger replacement.
string
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
DeviceName Changes to this property will trigger replacement. string

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

Interface Changes to this property will trigger replacement. string

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

Mode Changes to this property will trigger replacement. string

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

Project Changes to this property will trigger replacement. string
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
Zone Changes to this property will trigger replacement. string
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
disk
This property is required.
Changes to this property will trigger replacement.
String
name or self_link of the disk that will be attached.


instance
This property is required.
Changes to this property will trigger replacement.
String
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
deviceName Changes to this property will trigger replacement. String

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

interface_ Changes to this property will trigger replacement. String

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

mode Changes to this property will trigger replacement. String

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

project Changes to this property will trigger replacement. String
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
zone Changes to this property will trigger replacement. String
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
disk
This property is required.
Changes to this property will trigger replacement.
string
name or self_link of the disk that will be attached.


instance
This property is required.
Changes to this property will trigger replacement.
string
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
deviceName Changes to this property will trigger replacement. string

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

interface Changes to this property will trigger replacement. string

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

mode Changes to this property will trigger replacement. string

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

project Changes to this property will trigger replacement. string
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
zone Changes to this property will trigger replacement. string
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
disk
This property is required.
Changes to this property will trigger replacement.
str
name or self_link of the disk that will be attached.


instance
This property is required.
Changes to this property will trigger replacement.
str
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
device_name Changes to this property will trigger replacement. str

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

interface Changes to this property will trigger replacement. str

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

mode Changes to this property will trigger replacement. str

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

project Changes to this property will trigger replacement. str
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
zone Changes to this property will trigger replacement. str
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
disk
This property is required.
Changes to this property will trigger replacement.
String
name or self_link of the disk that will be attached.


instance
This property is required.
Changes to this property will trigger replacement.
String
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
deviceName Changes to this property will trigger replacement. String

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

interface Changes to this property will trigger replacement. String

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

mode Changes to this property will trigger replacement. String

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

project Changes to this property will trigger replacement. String
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
zone Changes to this property will trigger replacement. String
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.

Outputs

All input properties are implicitly available as output properties. Additionally, the AttachedDisk resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing AttachedDisk Resource

Get an existing AttachedDisk resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AttachedDiskState, opts?: CustomResourceOptions): AttachedDisk
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        device_name: Optional[str] = None,
        disk: Optional[str] = None,
        instance: Optional[str] = None,
        interface: Optional[str] = None,
        mode: Optional[str] = None,
        project: Optional[str] = None,
        zone: Optional[str] = None) -> AttachedDisk
func GetAttachedDisk(ctx *Context, name string, id IDInput, state *AttachedDiskState, opts ...ResourceOption) (*AttachedDisk, error)
public static AttachedDisk Get(string name, Input<string> id, AttachedDiskState? state, CustomResourceOptions? opts = null)
public static AttachedDisk get(String name, Output<String> id, AttachedDiskState state, CustomResourceOptions options)
resources:  _:    type: gcp:compute:AttachedDisk    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
DeviceName Changes to this property will trigger replacement. string

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

Disk Changes to this property will trigger replacement. string
name or self_link of the disk that will be attached.


Instance Changes to this property will trigger replacement. string
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
Interface Changes to this property will trigger replacement. string

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

Mode Changes to this property will trigger replacement. string

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

Project Changes to this property will trigger replacement. string
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
Zone Changes to this property will trigger replacement. string
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
DeviceName Changes to this property will trigger replacement. string

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

Disk Changes to this property will trigger replacement. string
name or self_link of the disk that will be attached.


Instance Changes to this property will trigger replacement. string
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
Interface Changes to this property will trigger replacement. string

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

Mode Changes to this property will trigger replacement. string

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

Project Changes to this property will trigger replacement. string
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
Zone Changes to this property will trigger replacement. string
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
deviceName Changes to this property will trigger replacement. String

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

disk Changes to this property will trigger replacement. String
name or self_link of the disk that will be attached.


instance Changes to this property will trigger replacement. String
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
interface_ Changes to this property will trigger replacement. String

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

mode Changes to this property will trigger replacement. String

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

project Changes to this property will trigger replacement. String
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
zone Changes to this property will trigger replacement. String
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
deviceName Changes to this property will trigger replacement. string

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

disk Changes to this property will trigger replacement. string
name or self_link of the disk that will be attached.


instance Changes to this property will trigger replacement. string
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
interface Changes to this property will trigger replacement. string

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

mode Changes to this property will trigger replacement. string

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

project Changes to this property will trigger replacement. string
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
zone Changes to this property will trigger replacement. string
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
device_name Changes to this property will trigger replacement. str

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

disk Changes to this property will trigger replacement. str
name or self_link of the disk that will be attached.


instance Changes to this property will trigger replacement. str
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
interface Changes to this property will trigger replacement. str

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

mode Changes to this property will trigger replacement. str

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

project Changes to this property will trigger replacement. str
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
zone Changes to this property will trigger replacement. str
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.
deviceName Changes to this property will trigger replacement. String

Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance.

If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine.

disk Changes to this property will trigger replacement. String
name or self_link of the disk that will be attached.


instance Changes to this property will trigger replacement. String
name or self_link of the compute instance that the disk will be attached to. If the self_link is provided then zone and project are extracted from the self link. If only the name is used then zone and project must be defined as properties on the resource or provider.
interface Changes to this property will trigger replacement. String

The disk interface used for attaching this disk.

This field is only used for specific cases, please don't specify this field without advice from Google. Not specifying the field will allow the the server to assign the correct interface.

Possible values: "SCSI" "NVME"

mode Changes to this property will trigger replacement. String

The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode.

Possible values: "READ_ONLY" "READ_WRITE"

project Changes to this property will trigger replacement. String
The project that the referenced compute instance is a part of. If instance is referenced by its self_link the project defined in the link will take precedence.
zone Changes to this property will trigger replacement. String
The zone that the referenced compute instance is located within. If instance is referenced by its self_link the zone defined in the link will take precedence.

Import

Attached Disk can be imported the following ways:

  • projects/{{project}}/zones/{{zone}}/instances/{{instance.name}}/{{disk.name}}

  • {{project}}/{{zone}}/{{instance.name}}/{{disk.name}}

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

$ pulumi import gcp:compute/attachedDisk:AttachedDisk default projects/{{project}}/zones/{{zone}}/instances/{{instance.name}}/{{disk.name}}
Copy
$ pulumi import gcp:compute/attachedDisk:AttachedDisk default {{project}}/{{zone}}/{{instance.name}}/{{disk.name}}
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.