UNPKG

@pulumi/gcp

Version:

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

492 lines (491 loc) • 16.6 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Patch deployments are configurations that individual patch jobs use to complete a patch. * These configurations include instance filter, package repository settings, and a schedule. * * To get more information about PatchDeployment, see: * * * [API documentation](https://cloud.google.com/compute/docs/osconfig/rest) * * How-to Guides * * [Official Documentation](https://cloud.google.com/compute/docs/os-patch-management) * * ## Example Usage * * ### Os Config Patch Deployment Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const patch = new gcp.osconfig.PatchDeployment("patch", { * patchDeploymentId: "patch-deploy", * instanceFilter: { * all: true, * }, * oneTimeSchedule: { * executeTime: "2999-10-10T10:10:10.045123456Z", * }, * }); * ``` * ### Os Config Patch Deployment Daily * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const patch = new gcp.osconfig.PatchDeployment("patch", { * patchDeploymentId: "patch-deploy", * instanceFilter: { * all: true, * }, * recurringSchedule: { * timeZone: { * id: "America/New_York", * }, * timeOfDay: { * hours: 0, * minutes: 30, * seconds: 30, * nanos: 20, * }, * }, * }); * ``` * ### Os Config Patch Deployment Daily Midnight * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const patch = new gcp.osconfig.PatchDeployment("patch", { * patchDeploymentId: "patch-deploy", * instanceFilter: { * all: true, * }, * recurringSchedule: { * timeZone: { * id: "America/New_York", * }, * timeOfDay: { * hours: 0, * minutes: 0, * seconds: 0, * nanos: 0, * }, * }, * }); * ``` * ### Os Config Patch Deployment Instance * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myImage = gcp.compute.getImage({ * family: "debian-11", * project: "debian-cloud", * }); * const foobar = new gcp.compute.Instance("foobar", { * name: "patch-deploy-inst", * machineType: "e2-medium", * zone: "us-central1-a", * canIpForward: false, * tags: [ * "foo", * "bar", * ], * bootDisk: { * initializeParams: { * image: myImage.then(myImage => myImage.selfLink), * }, * }, * networkInterfaces: [{ * network: "default", * }], * metadata: { * foo: "bar", * }, * }); * const patch = new gcp.osconfig.PatchDeployment("patch", { * patchDeploymentId: "patch-deploy", * instanceFilter: { * instances: [foobar.id], * }, * patchConfig: { * yum: { * security: true, * minimal: true, * excludes: ["bash"], * }, * }, * recurringSchedule: { * timeZone: { * id: "America/New_York", * }, * timeOfDay: { * hours: 0, * minutes: 30, * seconds: 30, * nanos: 20, * }, * monthly: { * monthDay: 1, * }, * }, * }); * ``` * ### Os Config Patch Deployment Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const patch = new gcp.osconfig.PatchDeployment("patch", { * patchDeploymentId: "patch-deploy", * instanceFilter: { * groupLabels: [{ * labels: { * env: "dev", * app: "web", * }, * }], * instanceNamePrefixes: ["test-"], * zones: [ * "us-central1-a", * "us-central-1c", * ], * }, * patchConfig: { * migInstancesAllowed: true, * rebootConfig: "ALWAYS", * apt: { * type: "DIST", * excludes: ["python"], * }, * yum: { * security: true, * minimal: true, * excludes: ["bash"], * }, * goo: { * enabled: true, * }, * zypper: { * categories: ["security"], * }, * windowsUpdate: { * classifications: [ * "CRITICAL", * "SECURITY", * "UPDATE", * ], * excludes: ["5012170"], * }, * preStep: { * linuxExecStepConfig: { * allowedSuccessCodes: [ * 0, * 3, * ], * localPath: "/tmp/pre_patch_script.sh", * }, * windowsExecStepConfig: { * interpreter: "SHELL", * allowedSuccessCodes: [ * 0, * 2, * ], * localPath: "C:\\Users\\user\\pre-patch-script.cmd", * }, * }, * postStep: { * linuxExecStepConfig: { * gcsObject: { * bucket: "my-patch-scripts", * generationNumber: "1523477886880", * object: "linux/post_patch_script", * }, * }, * windowsExecStepConfig: { * interpreter: "POWERSHELL", * gcsObject: { * bucket: "my-patch-scripts", * generationNumber: "135920493447", * object: "windows/post_patch_script.ps1", * }, * }, * }, * }, * duration: "10s", * recurringSchedule: { * timeZone: { * id: "America/New_York", * }, * timeOfDay: { * hours: 0, * minutes: 30, * seconds: 30, * nanos: 20, * }, * monthly: { * weekDayOfMonth: { * weekOrdinal: -1, * dayOfWeek: "TUESDAY", * dayOffset: 3, * }, * }, * }, * rollout: { * mode: "ZONE_BY_ZONE", * disruptionBudget: { * fixed: 1, * }, * }, * }); * ``` * * ## Import * * PatchDeployment can be imported using any of these accepted formats: * * * `{{project}}/{{name}}` * * * `{{project}} {{name}}` * * * `{{name}}` * * When using the `pulumi import` command, PatchDeployment can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:osconfig/patchDeployment:PatchDeployment default {{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:osconfig/patchDeployment:PatchDeployment default "{{project}} {{name}}" * ``` * * ```sh * $ pulumi import gcp:osconfig/patchDeployment:PatchDeployment default {{name}} * ``` */ export declare class PatchDeployment extends pulumi.CustomResource { /** * Get an existing PatchDeployment 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?: PatchDeploymentState, opts?: pulumi.CustomResourceOptions): PatchDeployment; /** * Returns true if the given object is an instance of PatchDeployment. 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 PatchDeployment; /** * Time the patch deployment was created. Timestamp is in RFC3339 text format. * A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". */ readonly createTime: pulumi.Output<string>; /** * Description of the patch deployment. Length of the description is limited to 1024 characters. */ readonly description: pulumi.Output<string | undefined>; /** * Duration of the patch. After the duration ends, the patch times out. * A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s" */ readonly duration: pulumi.Output<string | undefined>; /** * VM instances to patch. * Structure is documented below. */ readonly instanceFilter: pulumi.Output<outputs.osconfig.PatchDeploymentInstanceFilter>; /** * The last time a patch job was started by this deployment. Timestamp is in RFC3339 text format. * A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". */ readonly lastExecuteTime: pulumi.Output<string>; /** * Unique name for the patch deployment resource in a project. * The patch deployment name is in the form: projects/{project_id}/patchDeployments/{patchDeploymentId}. */ readonly name: pulumi.Output<string>; /** * Schedule a one-time execution. * Structure is documented below. */ readonly oneTimeSchedule: pulumi.Output<outputs.osconfig.PatchDeploymentOneTimeSchedule | undefined>; /** * Patch configuration that is applied. * Structure is documented below. */ readonly patchConfig: pulumi.Output<outputs.osconfig.PatchDeploymentPatchConfig | undefined>; /** * A name for the patch deployment in the project. When creating a name the following rules apply: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-63 characters. * * Must end with a number or a letter. * * Must be unique within the project. */ readonly patchDeploymentId: pulumi.Output<string>; /** * 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>; /** * Schedule recurring executions. * Structure is documented below. */ readonly recurringSchedule: pulumi.Output<outputs.osconfig.PatchDeploymentRecurringSchedule | undefined>; /** * Rollout strategy of the patch job. * Structure is documented below. */ readonly rollout: pulumi.Output<outputs.osconfig.PatchDeploymentRollout | undefined>; /** * Time the patch deployment was last updated. Timestamp is in RFC3339 text format. * A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". */ readonly updateTime: pulumi.Output<string>; /** * Create a PatchDeployment 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: PatchDeploymentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering PatchDeployment resources. */ export interface PatchDeploymentState { /** * Time the patch deployment was created. Timestamp is in RFC3339 text format. * A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". */ createTime?: pulumi.Input<string>; /** * Description of the patch deployment. Length of the description is limited to 1024 characters. */ description?: pulumi.Input<string>; /** * Duration of the patch. After the duration ends, the patch times out. * A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s" */ duration?: pulumi.Input<string>; /** * VM instances to patch. * Structure is documented below. */ instanceFilter?: pulumi.Input<inputs.osconfig.PatchDeploymentInstanceFilter>; /** * The last time a patch job was started by this deployment. Timestamp is in RFC3339 text format. * A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". */ lastExecuteTime?: pulumi.Input<string>; /** * Unique name for the patch deployment resource in a project. * The patch deployment name is in the form: projects/{project_id}/patchDeployments/{patchDeploymentId}. */ name?: pulumi.Input<string>; /** * Schedule a one-time execution. * Structure is documented below. */ oneTimeSchedule?: pulumi.Input<inputs.osconfig.PatchDeploymentOneTimeSchedule>; /** * Patch configuration that is applied. * Structure is documented below. */ patchConfig?: pulumi.Input<inputs.osconfig.PatchDeploymentPatchConfig>; /** * A name for the patch deployment in the project. When creating a name the following rules apply: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-63 characters. * * Must end with a number or a letter. * * Must be unique within the project. */ patchDeploymentId?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * Schedule recurring executions. * Structure is documented below. */ recurringSchedule?: pulumi.Input<inputs.osconfig.PatchDeploymentRecurringSchedule>; /** * Rollout strategy of the patch job. * Structure is documented below. */ rollout?: pulumi.Input<inputs.osconfig.PatchDeploymentRollout>; /** * Time the patch deployment was last updated. Timestamp is in RFC3339 text format. * A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". */ updateTime?: pulumi.Input<string>; } /** * The set of arguments for constructing a PatchDeployment resource. */ export interface PatchDeploymentArgs { /** * Description of the patch deployment. Length of the description is limited to 1024 characters. */ description?: pulumi.Input<string>; /** * Duration of the patch. After the duration ends, the patch times out. * A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s" */ duration?: pulumi.Input<string>; /** * VM instances to patch. * Structure is documented below. */ instanceFilter: pulumi.Input<inputs.osconfig.PatchDeploymentInstanceFilter>; /** * Schedule a one-time execution. * Structure is documented below. */ oneTimeSchedule?: pulumi.Input<inputs.osconfig.PatchDeploymentOneTimeSchedule>; /** * Patch configuration that is applied. * Structure is documented below. */ patchConfig?: pulumi.Input<inputs.osconfig.PatchDeploymentPatchConfig>; /** * A name for the patch deployment in the project. When creating a name the following rules apply: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-63 characters. * * Must end with a number or a letter. * * Must be unique within the project. */ patchDeploymentId: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * Schedule recurring executions. * Structure is documented below. */ recurringSchedule?: pulumi.Input<inputs.osconfig.PatchDeploymentRecurringSchedule>; /** * Rollout strategy of the patch job. * Structure is documented below. */ rollout?: pulumi.Input<inputs.osconfig.PatchDeploymentRollout>; }