2014-08-26 23:50:29 +02:00
|
|
|
---
|
|
|
|
layout: "google"
|
|
|
|
page_title: "Google: google_compute_disk"
|
2015-10-23 16:10:41 +02:00
|
|
|
sidebar_current: "docs-google-compute-disk"
|
2014-10-22 05:21:56 +02:00
|
|
|
description: |-
|
|
|
|
Creates a new persistent disk within GCE, based on another disk.
|
2014-08-26 23:50:29 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
# google\_compute\_disk
|
|
|
|
|
|
|
|
Creates a new persistent disk within GCE, based on another disk.
|
|
|
|
|
2017-03-29 11:37:36 +02:00
|
|
|
~> **Note:** 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).
|
|
|
|
|
2014-08-26 23:50:29 +02:00
|
|
|
## Example Usage
|
|
|
|
|
2017-04-17 12:17:54 +02:00
|
|
|
```hcl
|
2014-08-26 23:50:29 +02:00
|
|
|
resource "google_compute_disk" "default" {
|
2016-04-10 23:34:15 +02:00
|
|
|
name = "test-disk"
|
|
|
|
type = "pd-ssd"
|
|
|
|
zone = "us-central1-a"
|
2017-03-17 17:10:03 +01:00
|
|
|
image = "debian-cloud/debian-8"
|
2014-08-26 23:50:29 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `name` - (Required) A unique name for the resource, required by GCE.
|
|
|
|
Changing this forces a new resource to be created.
|
|
|
|
|
|
|
|
* `zone` - (Required) The zone where this disk will be available.
|
|
|
|
|
2016-04-10 23:34:15 +02:00
|
|
|
- - -
|
|
|
|
|
2017-01-18 14:49:48 +01:00
|
|
|
* `disk_encryption_key_raw` - (Optional) A 256-bit [customer-supplied encryption key]
|
|
|
|
(https://cloud.google.com/compute/docs/disks/customer-supplied-encryption),
|
|
|
|
encoded in [RFC 4648 base64](https://tools.ietf.org/html/rfc4648#section-4)
|
|
|
|
to encrypt this disk.
|
|
|
|
|
2017-03-14 06:15:37 +01:00
|
|
|
* `image` - (Optional) The image from which to initialize this disk. This can be
|
2017-03-14 07:39:07 +01:00
|
|
|
one of: the image's `self_link`, `projects/{project}/global/images/{image}`,
|
|
|
|
`projects/{project}/global/images/family/{family}`, `global/images/{image}`,
|
|
|
|
`global/images/family/{family}`, `family/{family}`, `{project}/{family}`,
|
|
|
|
`{project}/{image}`, `{family}`, or `{image}`.
|
2016-04-10 23:34:15 +02:00
|
|
|
|
|
|
|
* `project` - (Optional) The project in which the resource belongs. If it
|
|
|
|
is not provided, the provider project is used.
|
2014-08-26 23:50:29 +02:00
|
|
|
|
2016-04-10 23:34:15 +02:00
|
|
|
* `size` - (Optional) The size of the image in gigabytes. If not specified, it
|
|
|
|
will inherit the size of its base image.
|
2015-04-08 13:41:47 +02:00
|
|
|
|
2016-04-10 23:34:15 +02:00
|
|
|
* `snapshot` - (Optional) Name of snapshot from which to initialize this disk.
|
2014-08-26 23:50:29 +02:00
|
|
|
|
2014-10-07 06:59:09 +02:00
|
|
|
* `type` - (Optional) The GCE disk type.
|
|
|
|
|
2014-08-26 23:50:29 +02:00
|
|
|
## Attributes Reference
|
|
|
|
|
2016-04-10 23:34:15 +02:00
|
|
|
In addition to the arguments listed above, the following computed attributes are
|
|
|
|
exported:
|
2014-08-26 23:50:29 +02:00
|
|
|
|
2017-01-18 14:49:48 +01:00
|
|
|
* `disk_encryption_key_sha256` - The [RFC 4648 base64]
|
|
|
|
(https://tools.ietf.org/html/rfc4648#section-4) encoded SHA-256 hash of the
|
|
|
|
[customer-supplied encryption key](https://cloud.google.com/compute/docs/disks/customer-supplied-encryption)
|
|
|
|
that protects this resource.
|
|
|
|
|
2016-04-10 23:34:15 +02:00
|
|
|
* `self_link` - The URI of the created resource.
|