@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
366 lines • 12.3 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PatchDeployment = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* 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,
* skipUnpatchableVms: 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}}
* $ terraform import google_os_config_patch_deployment.default "{{project}} {{name}}"
* $ pulumi import gcp:osconfig/patchDeployment:PatchDeployment default {{name}}
* ```
*/
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, id, state, opts) {
return new PatchDeployment(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:osconfig/patchDeployment: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) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === PatchDeployment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["duration"] = state?.duration;
resourceInputs["instanceFilter"] = state?.instanceFilter;
resourceInputs["lastExecuteTime"] = state?.lastExecuteTime;
resourceInputs["name"] = state?.name;
resourceInputs["oneTimeSchedule"] = state?.oneTimeSchedule;
resourceInputs["patchConfig"] = state?.patchConfig;
resourceInputs["patchDeploymentId"] = state?.patchDeploymentId;
resourceInputs["project"] = state?.project;
resourceInputs["recurringSchedule"] = state?.recurringSchedule;
resourceInputs["rollout"] = state?.rollout;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.instanceFilter === undefined && !opts.urn) {
throw new Error("Missing required property 'instanceFilter'");
}
if (args?.patchDeploymentId === undefined && !opts.urn) {
throw new Error("Missing required property 'patchDeploymentId'");
}
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["duration"] = args?.duration;
resourceInputs["instanceFilter"] = args?.instanceFilter;
resourceInputs["oneTimeSchedule"] = args?.oneTimeSchedule;
resourceInputs["patchConfig"] = args?.patchConfig;
resourceInputs["patchDeploymentId"] = args?.patchDeploymentId;
resourceInputs["project"] = args?.project;
resourceInputs["recurringSchedule"] = args?.recurringSchedule;
resourceInputs["rollout"] = args?.rollout;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["lastExecuteTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PatchDeployment.__pulumiType, name, resourceInputs, opts);
}
}
exports.PatchDeployment = PatchDeployment;
//# sourceMappingURL=patchDeployment.js.map