mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 09:36:44 +00:00
182 lines
5.9 KiB
Markdown
182 lines
5.9 KiB
Markdown
---
|
|
# ----------------------------------------------------------------------------
|
|
#
|
|
# *** 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.
|
|
#
|
|
# ----------------------------------------------------------------------------
|
|
layout: "google"
|
|
page_title: "Google: google_compute_image"
|
|
sidebar_current: "docs-google-compute-image"
|
|
description: |-
|
|
Represents an Image resource.
|
|
---
|
|
|
|
# google\_compute\_image
|
|
|
|
Represents an Image resource.
|
|
|
|
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.
|
|
|
|
Images can be either public or custom.
|
|
|
|
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.
|
|
|
|
|
|
To get more information about Image, see:
|
|
|
|
* [API documentation](https://cloud.google.com/compute/docs/reference/latest/images)
|
|
* How-to Guides
|
|
* [Official Documentation](https://cloud.google.com/compute/docs/images)
|
|
|
|
<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
|
|
|
|
|
|
```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"
|
|
}
|
|
}
|
|
```
|
|
|
|
## Argument Reference
|
|
|
|
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.
|
|
|
|
|
|
- - -
|
|
|
|
|
|
* `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.
|
|
|
|
* `labels` -
|
|
(Optional)
|
|
Labels to apply to this Image.
|
|
|
|
* `licenses` -
|
|
(Optional)
|
|
Any applicable license URI.
|
|
|
|
* `raw_disk` -
|
|
(Optional)
|
|
The parameters of the raw disk image. Structure is documented below.
|
|
|
|
* `source_disk` -
|
|
(Optional)
|
|
The source disk to create this image based on.
|
|
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.
|
|
|
|
|
|
The `raw_disk` block supports:
|
|
|
|
* `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.
|
|
|
|
* `sha1` -
|
|
(Optional)
|
|
An optional SHA1 checksum of the disk image before unpackaging.
|
|
This is provided by the client when the disk image is created.
|
|
|
|
* `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.
|
|
|
|
## Attributes Reference
|
|
|
|
In addition to the arguments listed above, the following computed attributes are exported:
|
|
|
|
|
|
* `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.
|
|
* `self_link` - The URI of the created resource.
|
|
|
|
|
|
## Timeouts
|
|
|
|
This resource provides the following
|
|
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
|
|
|
|
- `create` - Default is 4 minutes.
|
|
- `update` - Default is 4 minutes.
|
|
- `delete` - Default is 4 minutes.
|
|
|
|
## Import
|
|
|
|
Image can be imported using any of these accepted formats:
|
|
|
|
```
|
|
$ 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}}
|
|
```
|
|
|
|
-> 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.
|