UNPKG

@pulumi/gcp

Version:

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

239 lines • 10.6 kB
"use strict"; // *** 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.V2PolicyOrchestratorForFolder = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * PolicyOrchestrator helps managing project+zone level policy resources (e.g. * OS Policy Assignments), by providing tools to create, update and delete them * across projects and locations, at scale. * * ## Example Usage * * ### Osconfigv2 Policy Orchestrator For Folder Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as time from "@pulumiverse/time"; * * const myFolder = new gcp.organizations.Folder("my_folder", { * displayName: "po-folder", * parent: "organizations/123456789", * deletionProtection: false, * }); * const osconfigSa = new gcp.folder.ServiceIdentity("osconfig_sa", { * folder: myFolder.folderId, * service: "osconfig.googleapis.com", * }); * const rippleSa = new gcp.folder.ServiceIdentity("ripple_sa", { * folder: myFolder.folderId, * service: "progressiverollout.googleapis.com", * }); * const wait30Sec = new time.Sleep("wait_30_sec", {createDuration: "30s"}, { * dependsOn: [ * osconfigSa, * rippleSa, * ], * }); * const iamOsconfigServiceAgent = new gcp.folder.IAMMember("iam_osconfig_service_agent", { * folder: myFolder.folderId, * role: "roles/osconfig.serviceAgent", * member: osconfigSa.member, * }, { * dependsOn: [wait30Sec], * }); * const iamOsconfigRolloutServiceAgent = new gcp.folder.IAMMember("iam_osconfig_rollout_service_agent", { * folder: myFolder.folderId, * role: "roles/osconfig.rolloutServiceAgent", * member: pulumi.interpolate`serviceAccount:service-folder-${myFolder.folderId}@gcp-sa-osconfig-rollout.iam.gserviceaccount.com`, * }, { * dependsOn: [iamOsconfigServiceAgent], * }); * const iamProgressiverolloutServiceAgent = new gcp.folder.IAMMember("iam_progressiverollout_service_agent", { * folder: myFolder.folderId, * role: "roles/progressiverollout.serviceAgent", * member: rippleSa.member, * }, { * dependsOn: [iamOsconfigRolloutServiceAgent], * }); * const wait3Min = new time.Sleep("wait_3_min", {createDuration: "180s"}, { * dependsOn: [iamProgressiverolloutServiceAgent], * }); * const policyOrchestratorForFolder = new gcp.osconfig.V2PolicyOrchestratorForFolder("policy_orchestrator_for_folder", { * policyOrchestratorId: "po-folder", * folderId: myFolder.folderId, * state: "ACTIVE", * action: "UPSERT", * orchestratedResource: { * id: "test-orchestrated-resource-folder", * osPolicyAssignmentV1Payload: { * osPolicies: [{ * id: "test-os-policy-folder", * mode: "VALIDATION", * resourceGroups: [{ * resources: [{ * id: "resource-tf", * file: { * content: "file-content-tf", * path: "file-path-tf-1", * state: "PRESENT", * }, * }], * }], * }], * instanceFilter: { * inventories: [{ * osShortName: "windows-10", * }], * }, * rollout: { * disruptionBudget: { * percent: 100, * }, * minWaitDuration: "60s", * }, * }, * }, * labels: { * state: "active", * }, * orchestrationScope: { * selectors: [{ * locationSelector: { * includedLocations: [""], * }, * }], * }, * }, { * dependsOn: [wait3Min], * }); * ``` * * ## Import * * PolicyOrchestratorForFolder can be imported using any of these accepted formats: * * * `folders/{{folder_id}}/locations/global/policyOrchestrators/{{policy_orchestrator_id}}` * * `{{folder_id}}/{{policy_orchestrator_id}}` * * When using the `pulumi import` command, PolicyOrchestratorForFolder can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:osconfig/v2PolicyOrchestratorForFolder:V2PolicyOrchestratorForFolder default folders/{{folder_id}}/locations/global/policyOrchestrators/{{policy_orchestrator_id}} * $ pulumi import gcp:osconfig/v2PolicyOrchestratorForFolder:V2PolicyOrchestratorForFolder default {{folder_id}}/{{policy_orchestrator_id}} * ``` */ class V2PolicyOrchestratorForFolder extends pulumi.CustomResource { /** * Get an existing V2PolicyOrchestratorForFolder 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 V2PolicyOrchestratorForFolder(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:osconfig/v2PolicyOrchestratorForFolder:V2PolicyOrchestratorForFolder'; /** * Returns true if the given object is an instance of V2PolicyOrchestratorForFolder. 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'] === V2PolicyOrchestratorForFolder.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["action"] = state?.action; resourceInputs["createTime"] = state?.createTime; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["description"] = state?.description; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["etag"] = state?.etag; resourceInputs["folderId"] = state?.folderId; resourceInputs["labels"] = state?.labels; resourceInputs["name"] = state?.name; resourceInputs["orchestratedResource"] = state?.orchestratedResource; resourceInputs["orchestrationScope"] = state?.orchestrationScope; resourceInputs["orchestrationStates"] = state?.orchestrationStates; resourceInputs["policyOrchestratorId"] = state?.policyOrchestratorId; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["reconciling"] = state?.reconciling; resourceInputs["state"] = state?.state; resourceInputs["updateTime"] = state?.updateTime; } else { const args = argsOrState; if (args?.action === undefined && !opts.urn) { throw new Error("Missing required property 'action'"); } if (args?.folderId === undefined && !opts.urn) { throw new Error("Missing required property 'folderId'"); } if (args?.orchestratedResource === undefined && !opts.urn) { throw new Error("Missing required property 'orchestratedResource'"); } if (args?.policyOrchestratorId === undefined && !opts.urn) { throw new Error("Missing required property 'policyOrchestratorId'"); } resourceInputs["action"] = args?.action; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["description"] = args?.description; resourceInputs["folderId"] = args?.folderId; resourceInputs["labels"] = args?.labels; resourceInputs["orchestratedResource"] = args?.orchestratedResource; resourceInputs["orchestrationScope"] = args?.orchestrationScope; resourceInputs["policyOrchestratorId"] = args?.policyOrchestratorId; resourceInputs["state"] = args?.state; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["orchestrationStates"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["reconciling"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(V2PolicyOrchestratorForFolder.__pulumiType, name, resourceInputs, opts); } } exports.V2PolicyOrchestratorForFolder = V2PolicyOrchestratorForFolder; //# sourceMappingURL=v2policyOrchestratorForFolder.js.map