Skip to content

Commit 49f9757

Browse files
sethvargonat-henderson
authored andcommitted
Update example and clarify image project (hashicorp#1189)
This updates the example to focus more on google_compute_image and provides a real example for debian.
1 parent aaac3a1 commit 49f9757

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

website/docs/d/datasource_compute_image.html.markdown

+9-16
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,25 @@ description: |-
88

99
# google\_compute\_image
1010

11-
Get information about a Google Compute Image. Check that your service account has the `compute.imageUser` role if you want to share [custom images](https://cloud.google.com/compute/docs/images/sharing-images-across-projects) from another project. If you want to use [public images](https://cloud.google.com/compute/docs/images#os-compute-support), do not forget to specify the dedicated project. For more information see
11+
Get information about a Google Compute Image. Check that your service account has the `compute.imageUser` role if you want to share [custom images](https://cloud.google.com/compute/docs/images/sharing-images-across-projects) from another project. If you want to use [public images][pubimg], do not forget to specify the dedicated project. For more information see
1212
[the official documentation](https://cloud.google.com/compute/docs/images) and its [API](https://cloud.google.com/compute/docs/reference/latest/images).
1313

1414
## Example Usage
1515

1616
```hcl
1717
data "google_compute_image" "my_image" {
18-
name = "image"
19-
# could also use family = "family-name"
18+
name = "debian-9"
19+
project = "debian-cloud"
2020
}
2121
2222
resource "google_compute_instance" "default" {
23-
name = "test"
24-
machine_type = "n1-standard-1"
25-
zone = "us-central1-a"
23+
# ...
2624
2725
boot_disk {
2826
initialize_params {
2927
image = "${data.google_compute_image.my_image.self_link}"
3028
}
3129
}
32-
33-
network_interface {
34-
network = "default"
35-
36-
access_config {
37-
// Ephemeral IP
38-
}
39-
}
4030
}
4131
```
4232

@@ -51,8 +41,9 @@ that is part of an image family and is not deprecated.
5141

5242
- - -
5343

54-
* `project` - (Optional) The project in which the resource belongs. If it
55-
is not provided, the provider project is used.
44+
* `project` - (Optional) The project in which the resource belongs. If it is not
45+
provided, the provider project is used. If you are using a
46+
[public base image][pubimg], be sure to specify the correct Image Project.
5647

5748
## Attributes Reference
5849

@@ -80,3 +71,5 @@ exported:
8071
* `label_fingerprint` - A fingerprint for the labels being applied to this image.
8172
* `licenses` - A list of applicable license URI.
8273
* `status` - The status of the image. Possible values are **FAILED**, **PENDING**, or **READY**.
74+
75+
[pubimg]: https://cloud.google.com/compute/docs/images#os-compute-support "Google Cloud Public Base Images"

0 commit comments

Comments
 (0)