|
| 1 | +--- |
| 2 | +subcategory: "Compute Engine" |
| 3 | +layout: "google" |
| 4 | +page_title: "Google: google_compute_disk" |
| 5 | +sidebar_current: "docs-google-datasource-compute-disk" |
| 6 | +description: |- |
| 7 | + Get information about a Google Compute Persistent disks. |
| 8 | +--- |
| 9 | + |
| 10 | +# google\_compute\_disk |
| 11 | + |
| 12 | +Get information about a Google Compute Persistent disks. |
| 13 | + |
| 14 | +[the official documentation](https://cloud.google.com/compute/docs/disks) and its [API](https://cloud.google.com/compute/docs/reference/latest/disks). |
| 15 | + |
| 16 | +## Example Usage |
| 17 | + |
| 18 | +```hcl |
| 19 | +data "google_compute_disk" "persistent-boot-disk" { |
| 20 | + name = "persistent-boot-disk" |
| 21 | + project = "example" |
| 22 | +} |
| 23 | +
|
| 24 | +resource "google_compute_instance" "default" { |
| 25 | + # ... |
| 26 | + |
| 27 | + boot_disk { |
| 28 | + source = data.google_compute_disk.persistent-boot-disk.self_link |
| 29 | + auto_delete = false |
| 30 | + } |
| 31 | +} |
| 32 | +``` |
| 33 | + |
| 34 | +## Argument Reference |
| 35 | + |
| 36 | +The following arguments are supported: |
| 37 | + |
| 38 | +* `name` - (Required) The name of a specific disk. |
| 39 | + |
| 40 | +- - - |
| 41 | + |
| 42 | +* `zone` - (Optional) A reference to the zone where the disk resides. |
| 43 | + |
| 44 | +* `project` - (Optional) The ID of the project in which the resource belongs. |
| 45 | + If it is not provided, the provider project is used. |
| 46 | + |
| 47 | +## Attributes Reference |
| 48 | + |
| 49 | +In addition to the arguments listed above, the following computed attributes are exported: |
| 50 | + |
| 51 | +* `id` - an identifier for the resource with format `projects/{{project}}/zones/{{zone}}/disks/{{name}}` |
| 52 | + |
| 53 | +* `label_fingerprint` - |
| 54 | + The fingerprint used for optimistic locking of this resource. Used |
| 55 | + internally during updates. |
| 56 | + |
| 57 | +* `creation_timestamp` - |
| 58 | + Creation timestamp in RFC3339 text format. |
| 59 | + |
| 60 | +* `last_attach_timestamp` - |
| 61 | + Last attach timestamp in RFC3339 text format. |
| 62 | + |
| 63 | +* `last_detach_timestamp` - |
| 64 | + Last detach timestamp in RFC3339 text format. |
| 65 | + |
| 66 | +* `users` - |
| 67 | + Links to the users of the disk (attached instances) in form: |
| 68 | + project/zones/zone/instances/instance |
| 69 | + |
| 70 | +* `source_image_id` - |
| 71 | + The ID value of the image used to create this disk. This value |
| 72 | + identifies the exact image that was used to create this persistent |
| 73 | + disk. For example, if you created the persistent disk from an image |
| 74 | + that was later deleted and recreated under the same name, the source |
| 75 | + image ID would identify the exact version of the image that was used. |
| 76 | + |
| 77 | +* `source_snapshot_id` - |
| 78 | + The unique ID of the snapshot used to create this disk. This value |
| 79 | + identifies the exact snapshot that was used to create this persistent |
| 80 | + disk. For example, if you created the persistent disk from a snapshot |
| 81 | + that was later deleted and recreated under the same name, the source |
| 82 | + snapshot ID would identify the exact version of the snapshot that was |
| 83 | + used. |
| 84 | + |
| 85 | +* `description` - |
| 86 | + The optional description of this resource. |
| 87 | + |
| 88 | +* `labels` - A map of labels applied to this disk. |
| 89 | + |
| 90 | +* `size` - |
| 91 | + Size of the persistent disk, specified in GB. |
| 92 | + |
| 93 | +* `physical_block_size_bytes` - |
| 94 | + Physical block size of the persistent disk, in bytes. |
| 95 | + |
| 96 | +* `type` - |
| 97 | + URL of the disk type resource describing which disk type to use to |
| 98 | + create the disk. |
| 99 | + |
| 100 | +* `image` - |
| 101 | + The image from which to initialize this disk. |
| 102 | + |
| 103 | +* `zone` - |
| 104 | + A reference to the zone where the disk resides. |
| 105 | + |
| 106 | +* `source_image_encryption_key` - |
| 107 | + The customer-supplied encryption key of the source image. |
| 108 | + |
| 109 | +* `snapshot` - |
| 110 | + The source snapshot used to create this disk. |
| 111 | + |
| 112 | +* `source_snapshot_encryption_key` - |
| 113 | + (Optional) |
| 114 | + The customer-supplied encryption key of the source snapshot. |
| 115 | + |
| 116 | +* `self_link` - The URI of the created resource. |
0 commit comments