AttachedDisk

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.

Create a AttachedDisk Resource

def AttachedDisk(resource_name, opts=None, device_name=None, disk=None, instance=None, mode=None, project=None, zone=None, __props__=None);
func NewAttachedDisk(ctx *Context, name string, args AttachedDiskArgs, opts ...ResourceOption) (*AttachedDisk, error)
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.
opts ResourceOptions
A bag of options that control this 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.

AttachedDisk Resource Properties

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

Inputs

The AttachedDisk resource accepts the following input properties:

Disk string

name or self_link of the disk that will be attached.

Instance 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 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.

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.

Project 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 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 string

name or self_link of the disk that will be attached.

Instance 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 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.

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.

Project 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 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 string

name or self_link of the disk that will be attached.

instance 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 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.

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.

project 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 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 str

name or self_link of the disk that will be attached.

instance 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 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.

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.

project 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 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.

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 str
The provider-assigned unique ID for this managed resource.

Look up an 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
static get(resource_name, id, opts=None, device_name=None, disk=None, instance=None, mode=None, project=None, zone=None, __props__=None);
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)
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.

The following state arguments are supported:

DeviceName 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.

Disk string

name or self_link of the disk that will be attached.

Instance 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.

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.

Project 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 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 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.

Disk string

name or self_link of the disk that will be attached.

Instance 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.

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.

Project 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 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 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.

disk string

name or self_link of the disk that will be attached.

instance 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.

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.

project 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 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 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.

disk str

name or self_link of the disk that will be attached.

instance 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.

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.

project 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 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.

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.