UNPKG

@pulumi/gcp

Version:

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

314 lines • 12.4 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Represents a Machine Image resource. Machine images store all the configuration, * metadata, permissions, and data from one or more disks required to create a * Virtual machine (VM) instance. * * > **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. * See Provider Versions for more details on beta resources. * * To get more information about MachineImage, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/machineImages) * * How-to Guides * * [Official Documentation](https://cloud.google.com/compute/docs/machine-images) * * ## Example Usage * * ### Machine Image Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const vm = new gcp.compute.Instance("vm", { * name: "my-vm", * machineType: "e2-medium", * bootDisk: { * initializeParams: { * image: "debian-cloud/debian-11", * }, * }, * networkInterfaces: [{ * network: "default", * }], * }); * const image = new gcp.compute.MachineImage("image", { * name: "my-image", * sourceInstance: vm.selfLink, * }); * ``` * ### Compute Machine Image Kms * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const vm = new gcp.compute.Instance("vm", { * name: "my-vm", * machineType: "e2-medium", * bootDisk: { * initializeParams: { * image: "debian-cloud/debian-11", * }, * }, * networkInterfaces: [{ * network: "default", * }], * }); * const keyRing = new gcp.kms.KeyRing("key_ring", { * name: "keyring", * location: "us", * }); * const cryptoKey = new gcp.kms.CryptoKey("crypto_key", { * name: "key", * keyRing: keyRing.id, * }); * const image = new gcp.compute.MachineImage("image", { * name: "my-image", * sourceInstance: vm.selfLink, * machineImageEncryptionKey: { * kmsKeyName: cryptoKey.id, * }, * }); * ``` * ### Machine Image Resource Manager Tags * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const tagKey1 = new gcp.tags.TagKey("tag_key1", { * parent: project.then(project => `projects/${project.number}`), * shortName: "tagkey", * }); * const tagValue1 = new gcp.tags.TagValue("tag_value1", { * parent: tagKey1.id, * shortName: "tagvalue", * }); * const vm = new gcp.compute.Instance("vm", { * name: "my-vm", * machineType: "e2-medium", * bootDisk: { * initializeParams: { * image: "debian-cloud/debian-11", * }, * }, * networkInterfaces: [{ * network: "default", * }], * }); * const image = new gcp.compute.MachineImage("image", { * name: "my-image", * sourceInstance: vm.selfLink, * params: { * resourceManagerTags: pulumi.all([tagKey1.id, tagValue1.id]).apply(([tagKey1Id, tagValue1Id]) => { * [tagKey1Id]: tagValue1Id, * }), * }, * }); * ``` * * ## Import * * MachineImage can be imported using any of these accepted formats: * * * `projects/{{project}}/global/machineImages/{{name}}` * * `{{project}}/{{name}}` * * `{{name}}` * * When using the `pulumi import` command, MachineImage can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/machineImage:MachineImage default projects/{{project}}/global/machineImages/{{name}} * $ pulumi import gcp:compute/machineImage:MachineImage default {{project}}/{{name}} * $ pulumi import gcp:compute/machineImage:MachineImage default {{name}} * ``` */ export declare class MachineImage extends pulumi.CustomResource { /** * Get an existing MachineImage 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: string, id: pulumi.Input<pulumi.ID>, state?: MachineImageState, opts?: pulumi.CustomResourceOptions): MachineImage; /** * Returns true if the given object is an instance of MachineImage. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is MachineImage; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ readonly deletionPolicy: pulumi.Output<string>; /** * A text description of the resource. */ readonly description: pulumi.Output<string | undefined>; /** * Specify this to create an application consistent machine image by informing the OS to prepare for the snapshot process. * Currently only supported on Windows instances using the Volume Shadow Copy Service (VSS). */ readonly guestFlush: pulumi.Output<boolean | undefined>; /** * Encrypts the machine image using a customer-supplied encryption key. * After you encrypt a machine image with a customer-supplied key, you must * provide the same key if you use the machine image later (e.g. to create a * instance from the image) * Structure is documented below. */ readonly machineImageEncryptionKey: pulumi.Output<outputs.compute.MachineImageMachineImageEncryptionKey | undefined>; /** * Name of the resource. */ readonly name: pulumi.Output<string>; /** * Additional params passed with the request, but not persisted as part of resource payload. * Structure is documented below. */ readonly params: pulumi.Output<outputs.compute.MachineImageParams | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The URI of the created resource. */ readonly selfLink: pulumi.Output<string>; /** * The source instance used to create the machine image. You can provide this as a partial or full URL to the resource. */ readonly sourceInstance: pulumi.Output<string>; /** * The regional or multi-regional Cloud Storage bucket location where the machine image is stored. */ readonly storageLocations: pulumi.Output<string[]>; /** * Create a MachineImage resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: MachineImageArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering MachineImage resources. */ export interface MachineImageState { /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * A text description of the resource. */ description?: pulumi.Input<string | undefined>; /** * Specify this to create an application consistent machine image by informing the OS to prepare for the snapshot process. * Currently only supported on Windows instances using the Volume Shadow Copy Service (VSS). */ guestFlush?: pulumi.Input<boolean | undefined>; /** * Encrypts the machine image using a customer-supplied encryption key. * After you encrypt a machine image with a customer-supplied key, you must * provide the same key if you use the machine image later (e.g. to create a * instance from the image) * Structure is documented below. */ machineImageEncryptionKey?: pulumi.Input<inputs.compute.MachineImageMachineImageEncryptionKey | undefined>; /** * Name of the resource. */ name?: pulumi.Input<string | undefined>; /** * Additional params passed with the request, but not persisted as part of resource payload. * Structure is documented below. */ params?: pulumi.Input<inputs.compute.MachineImageParams | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; /** * The URI of the created resource. */ selfLink?: pulumi.Input<string | undefined>; /** * The source instance used to create the machine image. You can provide this as a partial or full URL to the resource. */ sourceInstance?: pulumi.Input<string | undefined>; /** * The regional or multi-regional Cloud Storage bucket location where the machine image is stored. */ storageLocations?: pulumi.Input<pulumi.Input<string>[] | undefined>; } /** * The set of arguments for constructing a MachineImage resource. */ export interface MachineImageArgs { /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * A text description of the resource. */ description?: pulumi.Input<string | undefined>; /** * Specify this to create an application consistent machine image by informing the OS to prepare for the snapshot process. * Currently only supported on Windows instances using the Volume Shadow Copy Service (VSS). */ guestFlush?: pulumi.Input<boolean | undefined>; /** * Encrypts the machine image using a customer-supplied encryption key. * After you encrypt a machine image with a customer-supplied key, you must * provide the same key if you use the machine image later (e.g. to create a * instance from the image) * Structure is documented below. */ machineImageEncryptionKey?: pulumi.Input<inputs.compute.MachineImageMachineImageEncryptionKey | undefined>; /** * Name of the resource. */ name?: pulumi.Input<string | undefined>; /** * Additional params passed with the request, but not persisted as part of resource payload. * Structure is documented below. */ params?: pulumi.Input<inputs.compute.MachineImageParams | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; /** * The source instance used to create the machine image. You can provide this as a partial or full URL to the resource. */ sourceInstance: pulumi.Input<string>; } //# sourceMappingURL=machineImage.d.ts.map