Google Compute Engine Region Disk

This page shows how to write Terraform for Compute Engine Region Disk and write them securely.

google_compute_region_disk (Terraform)

The Region Disk in Compute Engine can be configured in Terraform with the resource name google_compute_region_disk. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub

resource "google_compute_region_disk" "this" {
  description               = var.description
  labels                    = var.labels
  name                      =
  physical_block_size_bytes = var.physical_block_size_bytes
  project                   = var.project


  • creation_timestamp requiredcomputed - string
    • Creation timestamp in RFC3339 text format.

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

  • id optionalcomputed - string
  • label_fingerprint requiredcomputed - string
    • The fingerprint used for optimistic locking of this resource. Used internally during updates.

  • labels optional - map / string
    • Labels to apply to this disk. A list of key->value pairs.

  • last_attach_timestamp requiredcomputed - string
    • Last attach timestamp in RFC3339 text format.

  • last_detach_timestamp requiredcomputed - string
    • Last detach timestamp in RFC3339 text format.

  • name required - string
    • 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.

  • physical_block_size_bytes optionalcomputed - number
    • 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.

  • project optionalcomputed - string
  • region optionalcomputed - string
    • A reference to the region where the disk resides.

  • replica_zones required - list / string
    • URLs of the zones where the disk should be replicated to.

  • self_link requiredcomputed - string
  • size optionalcomputed - number
    • Size of the persistent disk, specified in GB. You can specify this field when creating a persistent disk using the sourceImage or sourceSnapshot parameter, or specify it alone to create an empty persistent disk. If you specify this field along with sourceImage or sourceSnapshot, the value of sizeGb must not be less than the size of the sourceImage or the size of the snapshot.

  • snapshot optional - string
  • source_snapshot_id requiredcomputed - string
    • 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.

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

  • users requiredcomputed - list / string
    • Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance

Explanation in Terraform Registry

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:

Frequently asked questions

What is Google Compute Engine Region Disk?

Google Compute Engine Region Disk is a resource for Compute Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Compute Engine Region Disk?

For Terraform, the niveklabs/google source code example is useful. See the Terraform Example section for further details.


Scan your IaC problem in 3 minutes for free

You can keep your IaC security for free. No credit card required.