pulumi_wasm_providers_gcp_mini::compute

Module region_disk

source
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 RegionDisk, see:

§Example Usage

§Region Disk Basic

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let disk = disk::create(
        "disk",
        DiskArgs::builder()
            .image("debian-cloud/debian-11")
            .name("my-disk")
            .size(50)
            .type_("pd-ssd")
            .zone("us-central1-a")
            .build_struct(),
    );
    let regiondisk = region_disk::create(
        "regiondisk",
        RegionDiskArgs::builder()
            .name("my-region-disk")
            .physical_block_size_bytes(4096)
            .region("us-central1")
            .replica_zones(vec!["us-central1-a", "us-central1-f",])
            .snapshot("${snapdisk.id}")
            .type_("pd-ssd")
            .build_struct(),
    );
    let snapdisk = snapshot::create(
        "snapdisk",
        SnapshotArgs::builder()
            .name("my-snapshot")
            .source_disk("${disk.name}")
            .zone("us-central1-a")
            .build_struct(),
    );
}

§Region Disk Async

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let primary = region_disk::create(
        "primary",
        RegionDiskArgs::builder()
            .name("primary-region-disk")
            .physical_block_size_bytes(4096)
            .region("us-central1")
            .replica_zones(vec!["us-central1-a", "us-central1-f",])
            .type_("pd-ssd")
            .build_struct(),
    );
    let secondary = region_disk::create(
        "secondary",
        RegionDiskArgs::builder()
            .async_primary_disk(
                RegionDiskAsyncPrimaryDisk::builder()
                    .disk("${primary.id}")
                    .build_struct(),
            )
            .name("secondary-region-disk")
            .physical_block_size_bytes(4096)
            .region("us-east1")
            .replica_zones(vec!["us-east1-b", "us-east1-c",])
            .type_("pd-ssd")
            .build_struct(),
    );
}

§Region Disk Features

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let regiondisk = region_disk::create(
        "regiondisk",
        RegionDiskArgs::builder()
            .guest_os_features(
                vec![
                    RegionDiskGuestOsFeature::builder(). type ("SECURE_BOOT")
                    .build_struct(), RegionDiskGuestOsFeature::builder(). type
                    ("MULTI_IP_SUBNET").build_struct(),
                    RegionDiskGuestOsFeature::builder(). type ("WINDOWS").build_struct(),
                ],
            )
            .licenses(
                vec![
                    "https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-core",
                ],
            )
            .name("my-region-features-disk")
            .physical_block_size_bytes(4096)
            .region("us-central1")
            .replica_zones(vec!["us-central1-a", "us-central1-f",])
            .type_("pd-ssd")
            .build_struct(),
    );
}

§Import

RegionDisk can be imported using any of these accepted formats:

  • projects/{{project}}/regions/{{region}}/disks/{{name}}

  • {{project}}/{{region}}/{{name}}

  • {{region}}/{{name}}

  • {{name}}

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

$ pulumi import gcp:compute/regionDisk:RegionDisk default projects/{{project}}/regions/{{region}}/disks/{{name}}
$ pulumi import gcp:compute/regionDisk:RegionDisk default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/regionDisk:RegionDisk default {{region}}/{{name}}
$ pulumi import gcp:compute/regionDisk:RegionDisk default {{name}}

Structs§

Functions§

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