@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
236 lines • 10.4 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.OsPolicyAssignment = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* OS policy assignment is an API resource that is used to apply a set of OS
* policies to a dynamically targeted group of Compute Engine VM instances. An OS
* policy is used to define the desired state configuration for a Compute Engine VM
* instance through a set of configuration resources that provide capabilities such
* as installing or removing software packages, or executing a script. For more
* information about the OS policy resource definitions and examples, see
* [OS policy and OS policy assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies).
*
* To get more information about OSPolicyAssignment, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/compute/docs/os-configuration-management/create-os-policy-assignment)
*
* ## Example Usage
*
* ### Os Config Os Policy Assignment Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.osconfig.OsPolicyAssignment("primary", {
* instanceFilter: {
* all: false,
* exclusionLabels: [{
* labels: {
* "label-two": "value-two",
* },
* }],
* inclusionLabels: [{
* labels: {
* "label-one": "value-one",
* },
* }],
* inventories: [{
* osShortName: "centos",
* osVersion: "8.*",
* }],
* },
* location: "us-central1-a",
* name: "policy-assignment",
* osPolicies: [{
* id: "policy",
* mode: "VALIDATION",
* resourceGroups: [{
* resources: [
* {
* id: "apt-to-yum",
* repository: {
* apt: {
* archiveType: "DEB",
* components: ["doc"],
* distribution: "debian",
* uri: "https://atl.mirrors.clouvider.net/debian",
* gpgKey: ".gnupg/pubring.kbx",
* },
* },
* },
* {
* id: "exec1",
* exec: {
* validate: {
* interpreter: "SHELL",
* args: ["arg1"],
* file: {
* localPath: "$HOME/script.sh",
* },
* outputFilePath: "$HOME/out",
* },
* enforce: {
* interpreter: "SHELL",
* args: ["arg1"],
* file: {
* allowInsecure: true,
* remote: {
* uri: "https://www.example.com/script.sh",
* sha256Checksum: "c7938fed83afdccbb0e86a2a2e4cad7d5035012ca3214b4a61268393635c3063",
* },
* },
* outputFilePath: "$HOME/out",
* },
* },
* },
* ],
* inventoryFilters: [{
* osShortName: "centos",
* osVersion: "8.*",
* }],
* }],
* allowNoResourceGroupMatch: false,
* description: "A test os policy",
* }],
* rollout: {
* disruptionBudget: {
* percent: 100,
* },
* minWaitDuration: "3s",
* },
* description: "A test os policy assignment",
* });
* ```
*
* ## Import
*
* OSPolicyAssignment can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
*
* When using the `pulumi import` command, OSPolicyAssignment can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}
* $ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default {{project}}/{{location}}/{{name}}
* $ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default {{location}}/{{name}}
* ```
*/
class OsPolicyAssignment extends pulumi.CustomResource {
/**
* Get an existing OsPolicyAssignment 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 OsPolicyAssignment(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:osconfig/osPolicyAssignment:OsPolicyAssignment';
/**
* Returns true if the given object is an instance of OsPolicyAssignment. 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'] === OsPolicyAssignment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["baseline"] = state?.baseline;
resourceInputs["deleted"] = state?.deleted;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["etag"] = state?.etag;
resourceInputs["instanceFilter"] = state?.instanceFilter;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["osPolicies"] = state?.osPolicies;
resourceInputs["project"] = state?.project;
resourceInputs["reconciling"] = state?.reconciling;
resourceInputs["revisionCreateTime"] = state?.revisionCreateTime;
resourceInputs["revisionId"] = state?.revisionId;
resourceInputs["rollout"] = state?.rollout;
resourceInputs["rolloutState"] = state?.rolloutState;
resourceInputs["skipAwaitRollout"] = state?.skipAwaitRollout;
resourceInputs["uid"] = state?.uid;
}
else {
const args = argsOrState;
if (args?.instanceFilter === undefined && !opts.urn) {
throw new Error("Missing required property 'instanceFilter'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.osPolicies === undefined && !opts.urn) {
throw new Error("Missing required property 'osPolicies'");
}
if (args?.rollout === undefined && !opts.urn) {
throw new Error("Missing required property 'rollout'");
}
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["instanceFilter"] = args?.instanceFilter;
resourceInputs["location"] = args?.location;
resourceInputs["name"] = args?.name;
resourceInputs["osPolicies"] = args?.osPolicies;
resourceInputs["project"] = args?.project;
resourceInputs["rollout"] = args?.rollout;
resourceInputs["skipAwaitRollout"] = args?.skipAwaitRollout;
resourceInputs["baseline"] = undefined /*out*/;
resourceInputs["deleted"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["reconciling"] = undefined /*out*/;
resourceInputs["revisionCreateTime"] = undefined /*out*/;
resourceInputs["revisionId"] = undefined /*out*/;
resourceInputs["rolloutState"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OsPolicyAssignment.__pulumiType, name, resourceInputs, opts);
}
}
exports.OsPolicyAssignment = OsPolicyAssignment;
//# sourceMappingURL=osPolicyAssignment.js.map