Class 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:
- API documentation
- How-to Guides
- Adding a persistent disk
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.
Inherited Members
Namespace: Pulumi.Gcp.Compute
Assembly: Pulumi.Gcp.dll
Syntax
public class AttachedDisk : CustomResource
Constructors
View SourceAttachedDisk(String, AttachedDiskArgs, CustomResourceOptions)
Create a AttachedDisk resource with the given unique name, arguments, and options.
Declaration
public AttachedDisk(string name, AttachedDiskArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| AttachedDiskArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceDeviceName
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.
Declaration
public Output<string> DeviceName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Disk
name or self_link of the disk that will be attached.
Declaration
public Output<string> Disk { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Instance
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.
Declaration
public Output<string> Instance { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Mode
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.
Declaration
public Output<string> Mode { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Project
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.
Declaration
public Output<string> Project { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Zone
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.
Declaration
public Output<string> Zone { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, AttachedDiskState, CustomResourceOptions)
Get an existing AttachedDisk resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static AttachedDisk Get(string name, Input<string> id, AttachedDiskState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| AttachedDiskState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| AttachedDisk |