Skip to content

Commit dcea78c

Browse files
authored
fix instance template interaction with regional disks, make docs more clear about valid values (hashicorp#2138)
1 parent 73448ec commit dcea78c

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

docs/r/compute_instance_template.html.markdown

+17-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ resource "google_compute_instance_template" "default" {
4545
4646
// Use an existing disk resource
4747
disk {
48-
source = "foo_existing_disk"
48+
// Instance Templates reference disks by name, not self link
49+
source = "${google_compute_disk.foobar.name}"
4950
auto_delete = false
5051
boot = false
5152
}
@@ -62,6 +63,19 @@ resource "google_compute_instance_template" "default" {
6263
scopes = ["userinfo-email", "compute-ro", "storage-ro"]
6364
}
6465
}
66+
67+
data "google_compute_image" "my_image" {
68+
family = "debian-9"
69+
project = "debian-cloud"
70+
}
71+
72+
resource "google_compute_disk" "foobar" {
73+
name = "existing-disk"
74+
image = "${data.google_compute_image.my_image.self_link}"
75+
size = 10
76+
type = "pd-ssd"
77+
zone = "us-central1-a"
78+
}
6579
```
6680

6781
## Using with Instance Group Manager
@@ -260,9 +274,8 @@ The `disk` block supports:
260274
or READ_ONLY. If you are attaching or creating a boot disk, this must
261275
read-write mode.
262276

263-
* `source` - (Required if source_image not set) The name of the disk (such as
264-
those managed by `google_compute_disk`) to attach. This cannot be a regional
265-
disk.
277+
* `source` - (Required if source_image not set) The name (**not self_link**)
278+
of the disk (such as those managed by `google_compute_disk`) to attach.
266279

267280
* `disk_type` - (Optional) The GCE disk type. Can be either `"pd-ssd"`,
268281
`"local-ssd"`, or `"pd-standard"`.

0 commit comments

Comments
 (0)