Package com.pulumi.gcp.compute
Class Image
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.gcp.compute.Image
-
public class Image extends com.pulumi.resources.CustomResource
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/v1/images) * How-to Guides * [Official Documentation](https://cloud.google.com/compute/docs/images) ## Example Usage ### Image Basic ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.Image; import com.pulumi.gcp.compute.ImageArgs; import com.pulumi.gcp.compute.inputs.ImageRawDiskArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Image("example", ImageArgs.builder() .rawDisk(ImageRawDiskArgs.builder() .source("https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz") .build()) .build()); } } ``` ### Image Guest Os ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.Image; import com.pulumi.gcp.compute.ImageArgs; import com.pulumi.gcp.compute.inputs.ImageGuestOsFeatureArgs; import com.pulumi.gcp.compute.inputs.ImageRawDiskArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Image("example", ImageArgs.builder() .guestOsFeatures( ImageGuestOsFeatureArgs.builder() .type("SECURE_BOOT") .build(), ImageGuestOsFeatureArgs.builder() .type("MULTI_IP_SUBNET") .build()) .rawDisk(ImageRawDiskArgs.builder() .source("https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz") .build()) .build()); } } ``` ### Image Basic Storage Location ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.Image; import com.pulumi.gcp.compute.ImageArgs; import com.pulumi.gcp.compute.inputs.ImageRawDiskArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Image("example", ImageArgs.builder() .rawDisk(ImageRawDiskArgs.builder() .source("https://storage.googleapis.com/bosh-gce-raw-stemcells/bosh-stemcell-97.98-google-kvm-ubuntu-xenial-go_agent-raw-1557960142.tar.gz") .build()) .storageLocations("us-central1") .build()); } } ``` ## Import Image can be imported using any of these accepted formats ```sh $ pulumi import gcp:compute/image:Image default projects/{{project}}/global/images/{{name}} ``` ```sh $ pulumi import gcp:compute/image:Image default {{project}}/{{name}} ``` ```sh $ pulumi import gcp:compute/image:Image default {{name}} ```
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.Integer>
archiveSizeBytes()
com.pulumi.core.Output<java.lang.String>
creationTimestamp()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
description()
com.pulumi.core.Output<java.lang.Integer>
diskSizeGb()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
family()
static Image
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ImageState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.List<ImageGuestOsFeature>>
guestOsFeatures()
com.pulumi.core.Output<java.util.Optional<ImageImageEncryptionKey>>
imageEncryptionKey()
com.pulumi.core.Output<java.lang.String>
labelFingerprint()
com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>
labels()
com.pulumi.core.Output<java.util.List<java.lang.String>>
licenses()
com.pulumi.core.Output<java.lang.String>
name()
com.pulumi.core.Output<java.lang.String>
project()
com.pulumi.core.Output<java.util.Optional<ImageRawDisk>>
rawDisk()
com.pulumi.core.Output<java.lang.String>
selfLink()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
sourceDisk()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
sourceImage()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
sourceSnapshot()
com.pulumi.core.Output<java.util.List<java.lang.String>>
storageLocations()
-
-
-
Constructor Detail
-
Image
public Image(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
Image
public Image(java.lang.String name, @Nullable ImageArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
Image
public Image(java.lang.String name, @Nullable ImageArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
archiveSizeBytes
public com.pulumi.core.Output<java.lang.Integer> archiveSizeBytes()
- Returns:
- Size of the image tar.gz archive stored in Google Cloud Storage (in bytes).
-
creationTimestamp
public com.pulumi.core.Output<java.lang.String> creationTimestamp()
- Returns:
- Creation timestamp in RFC3339 text format.
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- An optional description of this resource. Provide this property when you create the resource.
-
diskSizeGb
public com.pulumi.core.Output<java.lang.Integer> diskSizeGb()
- Returns:
- Size of the image when restored onto a persistent disk (in GB).
-
family
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> family()
- Returns:
- 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.
-
guestOsFeatures
public com.pulumi.core.Output<java.util.List<ImageGuestOsFeature>> guestOsFeatures()
- Returns:
- A list of features to enable on the guest operating system. Applicable only for bootable images. Structure is documented below.
-
imageEncryptionKey
public com.pulumi.core.Output<java.util.Optional<ImageImageEncryptionKey>> imageEncryptionKey()
- Returns:
- Encrypts the image using a customer-supplied encryption key. After you encrypt an image with a customer-supplied key, you must provide the same key if you use the image later (e.g. to create a disk from the image) Structure is documented below.
-
labelFingerprint
public com.pulumi.core.Output<java.lang.String> labelFingerprint()
- Returns:
- The fingerprint used for optimistic locking of this resource. Used internally during updates.
-
labels
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> labels()
- Returns:
- Labels to apply to this Image.
-
licenses
public com.pulumi.core.Output<java.util.List<java.lang.String>> licenses()
- Returns:
- Any applicable license URI.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- 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?` 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. ***
-
project
public com.pulumi.core.Output<java.lang.String> project()
- Returns:
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
-
rawDisk
public com.pulumi.core.Output<java.util.Optional<ImageRawDisk>> rawDisk()
- Returns:
- The parameters of the raw disk image. Structure is documented below.
-
selfLink
public com.pulumi.core.Output<java.lang.String> selfLink()
- Returns:
- The URI of the created resource.
-
sourceDisk
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> sourceDisk()
- Returns:
- 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.
-
sourceImage
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> sourceImage()
- Returns:
- URL of the source image used to create this image. In order to create an image, you must provide the full or partial URL of one of the following: * The selfLink URL * This property * The rawDisk.source URL * The sourceDisk URL
-
sourceSnapshot
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> sourceSnapshot()
- Returns:
- URL of the source snapshot used to create this image. In order to create an image, you must provide the full or partial URL of one of the following: * The selfLink URL * This property * The sourceImage URL * The rawDisk.source URL * The sourceDisk URL
-
storageLocations
public com.pulumi.core.Output<java.util.List<java.lang.String>> storageLocations()
- Returns:
- Cloud Storage bucket storage location of the image (regional or multi-regional). Reference link: https://cloud.google.com/compute/docs/reference/rest/v1/images
-
get
public static Image get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ImageState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-