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:
- API documentation
- How-to Guides
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,
});
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)
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
})
}
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,
});
});
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());
}
}
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
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 string
- The unique name of the resource.
- args AttachedDiskArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args 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 string
- The unique name of the resource.
- args AttachedDiskArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AttachedDiskArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
});
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"),
})
var attachedDiskResource = new AttachedDisk("attachedDiskResource", AttachedDiskArgs.builder()
.disk("string")
.instance("string")
.deviceName("string")
.interface_("string")
.mode("string")
.project("string")
.zone("string")
.build());
attached_disk_resource = gcp.compute.AttachedDisk("attachedDiskResource",
disk="string",
instance="string",
device_name="string",
interface="string",
mode="string",
project="string",
zone="string")
const attachedDiskResource = new gcp.compute.AttachedDisk("attachedDiskResource", {
disk: "string",
instance: "string",
deviceName: "string",
"interface": "string",
mode: "string",
project: "string",
zone: "string",
});
type: gcp:compute:AttachedDisk
properties:
deviceName: string
disk: string
instance: string
interface: string
mode: string
project: string
zone: string
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 string
name
orself_link
of the disk that will be attached.- Instance string
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- Device
Name 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 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 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 string
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - Zone string
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- Disk string
name
orself_link
of the disk that will be attached.- Instance string
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- Device
Name 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 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 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 string
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - Zone string
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- disk String
name
orself_link
of the disk that will be attached.- instance String
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- device
Name 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_ 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 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 String
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - zone String
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- disk string
name
orself_link
of the disk that will be attached.- instance string
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- device
Name 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 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 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 string
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - zone string
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- disk str
name
orself_link
of the disk that will be attached.- instance str
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- device_
name 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 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 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 str
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - zone str
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- disk String
name
orself_link
of the disk that will be attached.- instance String
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- device
Name 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 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 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 String
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - zone String
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_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)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Device
Name 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 string
name
orself_link
of the disk that will be attached.- Instance string
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- Interface 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 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 string
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - Zone string
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- Device
Name 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 string
name
orself_link
of the disk that will be attached.- Instance string
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- Interface 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 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 string
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - Zone string
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- device
Name 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 String
name
orself_link
of the disk that will be attached.- instance String
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- interface_ 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 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 String
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - zone String
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- device
Name 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 string
name
orself_link
of the disk that will be attached.- instance string
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- interface 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 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 string
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - zone string
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- device_
name 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 str
name
orself_link
of the disk that will be attached.- instance str
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- interface 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 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 str
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - zone str
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_link
the zone defined in the link will take precedence.
- device
Name 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 String
name
orself_link
of the disk that will be attached.- instance String
name
orself_link
of the compute instance that the disk will be attached to. If theself_link
is provided thenzone
andproject
are extracted from the self link. If only the name is used thenzone
andproject
must be defined as properties on the resource or provider.- interface 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 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 String
- The project that the referenced compute instance is a part of. If
instance
is referenced by itsself_link
the project defined in the link will take precedence. - zone String
- The zone that the referenced compute instance is located within. If
instance
is referenced by itsself_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}}
$ pulumi import gcp:compute/attachedDisk:AttachedDisk default {{project}}/{{zone}}/{{instance.name}}/{{disk.name}}
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.