mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 01:26:43 +00:00
233 lines
7.7 KiB
Markdown
233 lines
7.7 KiB
Markdown
---
|
|
# ----------------------------------------------------------------------------
|
|
#
|
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
#
|
|
# ----------------------------------------------------------------------------
|
|
#
|
|
# This file is automatically generated by Magic Modules and manual
|
|
# changes will be clobbered when the file is regenerated.
|
|
#
|
|
# Please read more about how to change this file in
|
|
# .github/CONTRIBUTING.md.
|
|
#
|
|
# ----------------------------------------------------------------------------
|
|
layout: "google"
|
|
page_title: "Google: google_compute_region_disk"
|
|
sidebar_current: "docs-google-compute-region-disk"
|
|
description: |-
|
|
Persistent disks are durable storage devices that function similarly to
|
|
the physical disks in a desktop or a server.
|
|
---
|
|
|
|
# google\_compute\_region\_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 RegionDisk, see:
|
|
|
|
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)
|
|
* How-to Guides
|
|
* [Adding or Resizing Regional Persistent Disks](https://cloud.google.com/compute/docs/disks/regional-persistent-disk)
|
|
|
|
~> **Warning:** All arguments including the disk encryption key will be stored in the raw
|
|
state as plain-text.
|
|
[Read more about sensitive data in state](/docs/state/sensitive-data.html).
|
|
|
|
## Example Usage
|
|
|
|
```hcl
|
|
resource "google_compute_region_disk" "regiondisk" {
|
|
name = "my-region-disk"
|
|
snapshot = "${google_compute_snapshot.snapdisk.self_link}"
|
|
type = "pd-ssd"
|
|
region = "us-central1"
|
|
|
|
replica_zones = ["us-central1-a", "us-central1-f"]
|
|
}
|
|
|
|
resource "google_compute_disk" "disk" {
|
|
name = "my-disk"
|
|
image = "debian-cloud/debian-9"
|
|
size = 50
|
|
type = "pd-ssd"
|
|
zone = "us-central1-a"
|
|
}
|
|
|
|
resource "google_compute_snapshot" "snapdisk" {
|
|
name = "my-snapshot"
|
|
source_disk = "${google_compute_disk.disk.name}"
|
|
zone = "us-central1-a"
|
|
}
|
|
```
|
|
|
|
## Argument Reference
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
* `name` -
|
|
(Required)
|
|
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]([-a-z0-9]*[a-z0-9])?` 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.
|
|
|
|
* `replica_zones` -
|
|
(Required)
|
|
URLs of the zones where the disk should be replicated to.
|
|
|
|
|
|
- - -
|
|
|
|
|
|
* `description` -
|
|
(Optional)
|
|
An optional description of this resource. Provide this property when
|
|
you create the resource.
|
|
|
|
* `labels` -
|
|
(Optional)
|
|
Labels to apply to this disk. A list of key->value pairs.
|
|
|
|
* `size` -
|
|
(Optional)
|
|
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.
|
|
|
|
* `type` -
|
|
(Optional)
|
|
URL of the disk type resource describing which disk type to use to
|
|
create the disk. Provide this when creating the disk.
|
|
|
|
* `region` -
|
|
(Optional)
|
|
A reference to the region where the disk resides.
|
|
|
|
* `disk_encryption_key` -
|
|
(Optional)
|
|
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.
|
|
|
|
* `snapshot` -
|
|
(Optional)
|
|
The source snapshot used to create this disk. You can provide this as
|
|
a partial or full URL to the resource. 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`
|
|
|
|
* `source_snapshot_encryption_key` -
|
|
(Optional)
|
|
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.
|
|
* `project` - (Optional) The ID of the project in which the resource belongs.
|
|
If it is not provided, the provider project is used.
|
|
|
|
|
|
The `disk_encryption_key` block supports:
|
|
|
|
* `raw_key` -
|
|
(Optional)
|
|
Specifies a 256-bit customer-supplied encryption key, encoded in
|
|
RFC 4648 base64 to either encrypt or decrypt this resource.
|
|
|
|
* `sha256` -
|
|
The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied
|
|
encryption key that protects this resource.
|
|
|
|
The `source_snapshot_encryption_key` block supports:
|
|
|
|
* `raw_key` -
|
|
(Optional)
|
|
Specifies a 256-bit customer-supplied encryption key, encoded in
|
|
RFC 4648 base64 to either encrypt or decrypt this resource.
|
|
|
|
* `sha256` -
|
|
The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied
|
|
encryption key that protects this resource.
|
|
|
|
## Attributes Reference
|
|
|
|
In addition to the arguments listed above, the following computed attributes are exported:
|
|
|
|
|
|
* `label_fingerprint` -
|
|
The fingerprint used for optimistic locking of this resource. Used
|
|
internally during updates.
|
|
|
|
* `creation_timestamp` -
|
|
Creation timestamp in RFC3339 text format.
|
|
|
|
* `last_attach_timestamp` -
|
|
Last attach timestamp in RFC3339 text format.
|
|
|
|
* `last_detach_timestamp` -
|
|
Last dettach timestamp in RFC3339 text format.
|
|
|
|
* `users` -
|
|
Links to the users of the disk (attached instances) in form:
|
|
project/zones/zone/instances/instance
|
|
|
|
* `source_snapshot_id` -
|
|
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.
|
|
* `self_link` - The URI of the created resource.
|
|
|
|
|
|
## Timeouts
|
|
|
|
This resource provides the following
|
|
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
|
|
|
|
- `create` - Default is 5 minutes.
|
|
- `update` - Default is 4 minutes.
|
|
- `delete` - Default is 4 minutes.
|
|
|
|
## Import
|
|
|
|
RegionDisk can be imported using any of these accepted formats:
|
|
|
|
```
|
|
$ terraform import google_compute_region_disk.default projects/{{project}}/regions/{{region}}/disks/{{name}}
|
|
$ terraform import google_compute_region_disk.default {{project}}/{{region}}/{{name}}
|
|
$ terraform import google_compute_region_disk.default {{name}}
|
|
```
|