Show / Hide Table of Contents

Class Disk

Persistent disks are durable storage devices that function similarly to the physical disks in a desktop or a server. Compute Engine manages the hardware behind these devices to ensure data redundancy and optimize performance for you. Persistent disks are available as either standard hard disk drives (HDD) or solid-state drives (SSD).

Persistent disks are located independently from your virtual machine instances, so you can detach or move persistent disks to keep your data even after you delete your instances. Persistent disk performance scales automatically with size, so you can resize your existing persistent disks or add more persistent disks to an instance to meet your performance and storage space requirements.

Add a persistent disk to your instance when you need reliable and affordable storage with consistent performance characteristics.

To get more information about Disk, see:

  • API documentation
  • How-to Guides
  • Adding a persistent disk

Warning: All arguments including disk_encryption_key.raw_key will be stored in the raw state as plain-text. Read more about secrets in state.

Example Usage - Disk Basic

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Gcp.Compute.Disk("default", new Gcp.Compute.DiskArgs
    {
        Image = "debian-8-jessie-v20170523",
        Labels = 
        {
            { "environment", "dev" },
        },
        PhysicalBlockSizeBytes = 4096,
        Type = "pd-ssd",
        Zone = "us-central1-a",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Disk
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.Compute
Assembly: Pulumi.Gcp.dll
Syntax
public class Disk : CustomResource

Constructors

View Source

Disk(String, DiskArgs, CustomResourceOptions)

Create a Disk resource with the given unique name, arguments, and options.

Declaration
public Disk(string name, DiskArgs args = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

DiskArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

CreationTimestamp

Creation timestamp in RFC3339 text format.

Declaration
public Output<string> CreationTimestamp { get; }
Property Value
Type Description
Output<System.String>
View Source

Description

An optional description of this resource. Provide this property when you create the resource.

Declaration
public Output<string> Description { get; }
Property Value
Type Description
Output<System.String>
View Source

DiskEncryptionKey

Encrypts the disk using a customer-supplied encryption key. After you encrypt a disk with a customer-supplied key, you must provide the same key if you use the disk later (e.g. to create a disk snapshot or an image, or to attach the disk to a virtual machine). Customer-supplied encryption keys do not protect access to metadata of the disk. If you do not provide an encryption key when creating the disk, then the disk will be encrypted using an automatically generated key and you do not need to provide a key to use the disk later. Structure is documented below.

Declaration
public Output<DiskDiskEncryptionKey> DiskEncryptionKey { get; }
Property Value
Type Description
Output<DiskDiskEncryptionKey>
View Source

Image

The image from which to initialize this disk. This can be one of: the image's self_link, projects/{project}/global/images/{image}, projects/{project}/global/images/family/{family}, global/images/{image}, global/images/family/{family}, family/{family}, {project}/{family}, {project}/{image}, {family}, or {image}. If referred by family, the images names must include the family name. If they don't, use the gcp.compute.Image data source. For instance, the image centos-6-v20180104 includes its family name centos-6. These images can be referred by family name here.

Declaration
public Output<string> Image { get; }
Property Value
Type Description
Output<System.String>
View Source

LabelFingerprint

The fingerprint used for optimistic locking of this resource. Used internally during updates.

Declaration
public Output<string> LabelFingerprint { get; }
Property Value
Type Description
Output<System.String>
View Source

Labels

Labels to apply to this disk. A list of key->value pairs.

Declaration
public Output<ImmutableDictionary<string, string>> Labels { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>>
View Source

LastAttachTimestamp

Last attach timestamp in RFC3339 text format.

Declaration
public Output<string> LastAttachTimestamp { get; }
Property Value
Type Description
Output<System.String>
View Source

LastDetachTimestamp

Last detach timestamp in RFC3339 text format.

Declaration
public Output<string> LastDetachTimestamp { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

PhysicalBlockSizeBytes

Physical block size of the persistent disk, in bytes. If not present in a request, a default value is used. Currently supported sizes are 4096 and 16384, other sizes may be added in the future. If an unsupported value is requested, the error message will list the supported values for the caller's project.

Declaration
public Output<int> PhysicalBlockSizeBytes { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Project

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>
View Source

ResourcePolicies

Resource policies applied to this disk for automatic snapshot creations.

Declaration
public Output<ImmutableArray<string>> ResourcePolicies { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

SelfLink

The URI of the created resource.

Declaration
public Output<string> SelfLink { get; }
Property Value
Type Description
Output<System.String>
View Source

Size

Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the image or snapshot parameter, or specify it alone to create an empty persistent disk. If you specify this field along with image or snapshot, the value must not be less than the size of the image or the size of the snapshot.

Declaration
public Output<int> Size { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Snapshot

The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. If the snapshot is in another project than this disk, you must supply a full URL. For example, the following are valid values:

  • https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot
  • projects/project/global/snapshots/snapshot
  • global/snapshots/snapshot
  • snapshot
Declaration
public Output<string> Snapshot { get; }
Property Value
Type Description
Output<System.String>
View Source

SourceImageEncryptionKey

The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. Structure is documented below.

Declaration
public Output<DiskSourceImageEncryptionKey> SourceImageEncryptionKey { get; }
Property Value
Type Description
Output<DiskSourceImageEncryptionKey>
View Source

SourceImageId

The ID value of the image used to create this disk. This value identifies the exact image that was used to create this persistent disk. For example, if you created the persistent disk from an image that was later deleted and recreated under the same name, the source image ID would identify the exact version of the image that was used.

Declaration
public Output<string> SourceImageId { get; }
Property Value
Type Description
Output<System.String>
View Source

SourceSnapshotEncryptionKey

The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. Structure is documented below.

Declaration
public Output<DiskSourceSnapshotEncryptionKey> SourceSnapshotEncryptionKey { get; }
Property Value
Type Description
Output<DiskSourceSnapshotEncryptionKey>
View Source

SourceSnapshotId

The unique ID of the snapshot used to create this disk. This value identifies the exact snapshot that was used to create this persistent disk. For example, if you created the persistent disk from a snapshot that was later deleted and recreated under the same name, the source snapshot ID would identify the exact version of the snapshot that was used.

Declaration
public Output<string> SourceSnapshotId { get; }
Property Value
Type Description
Output<System.String>
View Source

Type

URL of the disk type resource describing which disk type to use to create the disk. Provide this when creating the disk.

Declaration
public Output<string> Type { get; }
Property Value
Type Description
Output<System.String>
View Source

Users

Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance

Declaration
public Output<ImmutableArray<string>> Users { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

Zone

A reference to the zone where the disk resides.

Declaration
public Output<string> Zone { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, DiskState, CustomResourceOptions)

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

Declaration
public static Disk Get(string name, Input<string> id, DiskState 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.

DiskState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Disk
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.