Expand description

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:

§Example Usage

§Disk Basic

resources:
  default:
    type: gcp:compute:Disk
    properties:
      name: test-disk
      type: pd-ssd
      zone: us-central1-a
      image: debian-11-bullseye-v20220719
      labels:
        environment: dev
      physicalBlockSizeBytes: 4096

§Disk Async

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let primary = disk::create(
        "primary",
        DiskArgs::builder()
            .name("async-test-disk")
            .physical_block_size_bytes(4096)
            .type_("pd-ssd")
            .zone("us-central1-a")
            .build_struct(),
    );
    let secondary = disk::create(
        "secondary",
        DiskArgs::builder()
            .async_primary_disk(
                DiskAsyncPrimaryDisk::builder().disk("${primary.id}").build_struct(),
            )
            .name("async-secondary-test-disk")
            .physical_block_size_bytes(4096)
            .type_("pd-ssd")
            .zone("us-east1-c")
            .build_struct(),
    );
}

§Disk Features

resources:
  default:
    type: gcp:compute:Disk
    properties:
      name: test-disk-features
      type: pd-ssd
      zone: us-central1-a
      labels:
        environment: dev
      guestOsFeatures:
        - type: SECURE_BOOT
        - type: MULTI_IP_SUBNET
        - type: WINDOWS
      licenses:
        - https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-core
      physicalBlockSizeBytes: 4096

§Import

Disk can be imported using any of these accepted formats:

  • projects/{{project}}/zones/{{zone}}/disks/{{name}}

  • {{project}}/{{zone}}/{{name}}

  • {{zone}}/{{name}}

  • {{name}}

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

$ pulumi import gcp:compute/disk:Disk default projects/{{project}}/zones/{{zone}}/disks/{{name}}
$ pulumi import gcp:compute/disk:Disk default {{project}}/{{zone}}/{{name}}
$ pulumi import gcp:compute/disk:Disk default {{zone}}/{{name}}
$ pulumi import gcp:compute/disk:Disk default {{name}}

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments