UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

226 lines • 9.27 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Image = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * 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 * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const debian = gcp.compute.getImage({ * family: "debian-12", * project: "debian-cloud", * }); * const persistent = new gcp.compute.Disk("persistent", { * name: "example-disk", * image: debian.then(debian => debian.selfLink), * size: 10, * type: "pd-ssd", * zone: "us-central1-a", * }); * const example = new gcp.compute.Image("example", { * name: "example-image", * sourceDisk: persistent.id, * }); * ``` * ### Image Guest Os * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const debian = gcp.compute.getImage({ * family: "debian-12", * project: "debian-cloud", * }); * const persistent = new gcp.compute.Disk("persistent", { * name: "example-disk", * image: debian.then(debian => debian.selfLink), * size: 10, * type: "pd-ssd", * zone: "us-central1-a", * }); * const example = new gcp.compute.Image("example", { * name: "example-image", * sourceDisk: persistent.id, * guestOsFeatures: [ * { * type: "UEFI_COMPATIBLE", * }, * { * type: "VIRTIO_SCSI_MULTIQUEUE", * }, * { * type: "GVNIC", * }, * { * type: "SEV_CAPABLE", * }, * { * type: "SEV_LIVE_MIGRATABLE_V2", * }, * ], * }); * ``` * ### Image Basic Storage Location * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const debian = gcp.compute.getImage({ * family: "debian-12", * project: "debian-cloud", * }); * const persistent = new gcp.compute.Disk("persistent", { * name: "example-disk", * image: debian.then(debian => debian.selfLink), * size: 10, * type: "pd-ssd", * zone: "us-central1-a", * }); * const example = new gcp.compute.Image("example", { * name: "example-sl-image", * sourceDisk: persistent.id, * storageLocations: ["us-central1"], * }); * ``` * * ## Import * * Image can be imported using any of these accepted formats: * * * `projects/{{project}}/global/images/{{name}}` * * * `{{project}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, Image can be imported using one of the formats above. For example: * * ```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}} * ``` */ class Image extends pulumi.CustomResource { /** * Get an existing Image resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Image(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Image. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Image.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["archiveSizeBytes"] = state ? state.archiveSizeBytes : undefined; resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["diskSizeGb"] = state ? state.diskSizeGb : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["family"] = state ? state.family : undefined; resourceInputs["guestOsFeatures"] = state ? state.guestOsFeatures : undefined; resourceInputs["imageEncryptionKey"] = state ? state.imageEncryptionKey : undefined; resourceInputs["labelFingerprint"] = state ? state.labelFingerprint : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["licenses"] = state ? state.licenses : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["rawDisk"] = state ? state.rawDisk : undefined; resourceInputs["selfLink"] = state ? state.selfLink : undefined; resourceInputs["shieldedInstanceInitialState"] = state ? state.shieldedInstanceInitialState : undefined; resourceInputs["sourceDisk"] = state ? state.sourceDisk : undefined; resourceInputs["sourceImage"] = state ? state.sourceImage : undefined; resourceInputs["sourceSnapshot"] = state ? state.sourceSnapshot : undefined; resourceInputs["storageLocations"] = state ? state.storageLocations : undefined; } else { const args = argsOrState; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["diskSizeGb"] = args ? args.diskSizeGb : undefined; resourceInputs["family"] = args ? args.family : undefined; resourceInputs["guestOsFeatures"] = args ? args.guestOsFeatures : undefined; resourceInputs["imageEncryptionKey"] = args ? args.imageEncryptionKey : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["licenses"] = args ? args.licenses : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["rawDisk"] = args ? args.rawDisk : undefined; resourceInputs["shieldedInstanceInitialState"] = args ? args.shieldedInstanceInitialState : undefined; resourceInputs["sourceDisk"] = args ? args.sourceDisk : undefined; resourceInputs["sourceImage"] = args ? args.sourceImage : undefined; resourceInputs["sourceSnapshot"] = args ? args.sourceSnapshot : undefined; resourceInputs["storageLocations"] = args ? args.storageLocations : undefined; resourceInputs["archiveSizeBytes"] = undefined /*out*/; resourceInputs["creationTimestamp"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["labelFingerprint"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["selfLink"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Image.__pulumiType, name, resourceInputs, opts); } } exports.Image = Image; /** @internal */ Image.__pulumiType = 'gcp:compute/image:Image'; //# sourceMappingURL=image.js.map