2016-08-12 02:35:33 +00:00
|
|
|
---
|
2019-01-03 00:05:38 +00:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# *** 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.
|
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
2016-08-12 02:35:33 +00:00
|
|
|
layout: "google"
|
|
|
|
page_title: "Google: google_compute_image"
|
|
|
|
sidebar_current: "docs-google-compute-image"
|
|
|
|
description: |-
|
2019-01-03 00:05:38 +00:00
|
|
|
Represents an Image resource.
|
2016-08-12 02:35:33 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# google\_compute\_image
|
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
Represents an Image resource.
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
Google Compute Engine uses operating system images to create the root
|
|
|
|
persistent disks for your instances. You specify an image when you create
|
|
|
|
an instance. Images contain a boot loader, an operating system, and a
|
|
|
|
root file system. Linux operating system images are also capable of
|
|
|
|
running containers on Compute Engine.
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
Images can be either public or custom.
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
Public images are provided and maintained by Google, open-source
|
|
|
|
communities, and third-party vendors. By default, all projects have
|
|
|
|
access to these images and can use them to create instances. Custom
|
|
|
|
images are available only to your project. You can create a custom image
|
|
|
|
from root persistent disks and other images. Then, use the custom image
|
|
|
|
to create an instance.
|
2017-02-18 22:48:50 +00:00
|
|
|
|
2018-06-28 16:49:34 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
To get more information about Image, see:
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2019-03-13 21:28:41 +00:00
|
|
|
* [API documentation](https://cloud.google.com/compute/docs/reference/v1/images)
|
2019-01-03 00:05:38 +00:00
|
|
|
* How-to Guides
|
|
|
|
* [Official Documentation](https://cloud.google.com/compute/docs/images)
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
|
|
|
|
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=image_basic&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
|
|
|
|
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
## Example Usage - Image Basic
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
resource "google_compute_image" "example" {
|
|
|
|
name = "example-image"
|
|
|
|
|
|
|
|
raw_disk {
|
|
|
|
source = "https://storage.googleapis.com/bosh-cpi-artifacts/bosh-stemcell-3262.4-google-kvm-ubuntu-trusty-go_agent-raw.tar.gz"
|
2016-08-12 02:35:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
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.
|
2016-08-12 02:35:33 +00:00
|
|
|
|
|
|
|
|
2018-02-02 18:56:18 +00:00
|
|
|
- - -
|
|
|
|
|
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
* `description` -
|
|
|
|
(Optional)
|
|
|
|
An optional description of this resource. Provide this property when
|
|
|
|
you create the resource.
|
|
|
|
|
|
|
|
* `disk_size_gb` -
|
|
|
|
(Optional)
|
|
|
|
Size of the image when restored onto a persistent disk (in GB).
|
|
|
|
|
|
|
|
* `family` -
|
|
|
|
(Optional)
|
|
|
|
The name of the image family to which this image belongs. You can
|
|
|
|
create disks by specifying an image family instead of a specific
|
|
|
|
image name. The image family always returns its latest image that is
|
|
|
|
not deprecated. The name of the image family must comply with
|
|
|
|
RFC1035.
|
2018-02-02 18:56:18 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
* `labels` -
|
|
|
|
(Optional)
|
|
|
|
Labels to apply to this Image.
|
2018-02-02 18:56:18 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
* `licenses` -
|
|
|
|
(Optional)
|
|
|
|
Any applicable license URI.
|
2016-11-01 10:32:47 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
* `raw_disk` -
|
|
|
|
(Optional)
|
|
|
|
The parameters of the raw disk image. Structure is documented below.
|
2018-02-02 18:56:18 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
* `source_disk` -
|
|
|
|
(Optional)
|
2019-01-10 16:33:09 +00:00
|
|
|
The source disk to create this image based on.
|
2019-01-03 00:05:38 +00:00
|
|
|
You must provide either this property or the
|
|
|
|
rawDisk.source property but not both to create an image.
|
|
|
|
* `project` - (Optional) The ID of the project in which the resource belongs.
|
|
|
|
If it is not provided, the provider project is used.
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2018-06-28 16:49:34 +00:00
|
|
|
|
2016-08-12 02:35:33 +00:00
|
|
|
The `raw_disk` block supports:
|
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
* `container_type` -
|
|
|
|
(Optional)
|
|
|
|
The format used to encode and transmit the block device, which
|
|
|
|
should be TAR. This is just a container and transmission format
|
|
|
|
and not a runtime format. Provided by the client when the disk
|
|
|
|
image is created.
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
* `sha1` -
|
|
|
|
(Optional)
|
|
|
|
An optional SHA1 checksum of the disk image before unpackaging.
|
|
|
|
This is provided by the client when the disk image is created.
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
* `source` -
|
|
|
|
(Required)
|
|
|
|
The full Google Cloud Storage URL where disk storage is stored
|
|
|
|
You must provide either this property or the sourceDisk property
|
|
|
|
but not both.
|
2016-08-12 02:35:33 +00:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
In addition to the arguments listed above, the following computed attributes are exported:
|
2016-08-12 02:35:33 +00:00
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
|
|
|
|
* `archive_size_bytes` -
|
|
|
|
Size of the image tar.gz archive stored in Google Cloud Storage (in
|
|
|
|
bytes).
|
|
|
|
|
|
|
|
* `creation_timestamp` -
|
|
|
|
Creation timestamp in RFC3339 text format.
|
|
|
|
|
|
|
|
* `label_fingerprint` -
|
|
|
|
The fingerprint used for optimistic locking of this resource. Used
|
|
|
|
internally during updates.
|
2016-08-12 02:35:33 +00:00
|
|
|
* `self_link` - The URI of the created resource.
|
2017-07-14 20:32:25 +00:00
|
|
|
|
2017-08-18 20:34:11 +00:00
|
|
|
|
2018-02-02 18:56:18 +00:00
|
|
|
## Timeouts
|
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
This resource provides the following
|
2018-02-02 18:56:18 +00:00
|
|
|
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
|
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
- `create` - Default is 4 minutes.
|
|
|
|
- `update` - Default is 4 minutes.
|
|
|
|
- `delete` - Default is 4 minutes.
|
2018-02-02 18:56:18 +00:00
|
|
|
|
2017-07-14 20:32:25 +00:00
|
|
|
## Import
|
|
|
|
|
2019-01-03 00:05:38 +00:00
|
|
|
Image can be imported using any of these accepted formats:
|
2017-07-14 20:32:25 +00:00
|
|
|
|
|
|
|
```
|
2019-01-03 00:05:38 +00:00
|
|
|
$ terraform import google_compute_image.default projects/{{project}}/global/images/{{name}}
|
|
|
|
$ terraform import google_compute_image.default {{project}}/{{name}}
|
|
|
|
$ terraform import google_compute_image.default {{name}}
|
2017-07-14 20:32:25 +00:00
|
|
|
```
|
2019-01-03 00:05:38 +00:00
|
|
|
|
|
|
|
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
|
|
|
|
as an argument so that Terraform uses the correct provider to import your resource.
|