1. Set up GCP SSD disk path in different zone


    A common requirement when working with cloud resources is creating and attaching a fast SSD disk to a Google Cloud Platform compute instance that may reside in a different zone. The Pulumi resource that represents a Google Cloud SSD disk is Disk.

    Below is an example of how you may accomplish this with Pulumi:

    import * as gcp from "@pulumi/gcp"; // Create a GCP compute disk const disk = new gcp.compute.Disk("myDisk", { size: 100, type: "pd-ssd", // SSD type disk physicalBlockSizeBytes: 4096, }); // Create a GCP compute instance in a different zone and attach the above disk const computeInstance = new gcp.compute.Instance("myInstance", { machineType: "f1-micro", // small machine type for example bootDisk: { initializeParams: { image: "debian-cloud/debian-9" } }, // boot from debian image networkInterfaces: [{ network: "default", accessConfigs: [{}], subnetwork: "default" }], // assign network settings zone: "us-west1-a", // the instance is created in the 'us-west1-a' zone attachedDisks: [{ // attach the above SSD disk to this compute instance source: disk.selfLink, boot: false, }], }); export const instanceName = computeInstance.name; export const diskName = disk.name;

    In the disk creation (new gcp.compute.Disk), we've chosen a size of 100 GB and SSD type (pd-ssd). You may adjust the size and type as needed.

    In the instance creation (new gcp.compute.Instance), we've chosen a f1-micro machine and we're using a default Debian image. These can be replaced with any valid machine type or boot image as needed.

    Finally, we attach the previously created disk to the instance using the attachedDisks property.

    Note that the zone property for the instance is set to 'us-west1-a'. Please ensure you replace it with the zone where you wish to create the instance, and ensure that the disk's region (implicitly set to the project's region) includes this zone.