@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
180 lines • 8.41 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.FoldersPolicyBinding = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* A policy binding to a folder. This is a Terraform resource, and maps to a policy binding resource in GCP.
*
* To get more information about FoldersPolicyBinding, see:
*
* * [API documentation](https://cloud.google.com/iam/docs/reference/rest/v3/folders.locations.policyBindings)
* * How-to Guides
* * [Apply a policy binding](https://cloud.google.com/iam/docs/principal-access-boundary-policies-create#create_binding)
*
* ## Example Usage
*
* ### Iam Folders Policy Binding
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as time from "@pulumiverse/time";
*
* const pabPolicy = new gcp.iam.PrincipalAccessBoundaryPolicy("pab_policy", {
* organization: "123456789",
* location: "global",
* displayName: "binding for all principals in the folder",
* principalAccessBoundaryPolicyId: "my-pab-policy",
* });
* const folder = new gcp.organizations.Folder("folder", {
* displayName: "my folder",
* parent: "organizations/123456789",
* deletionProtection: false,
* });
* const wait120s = new time.Sleep("wait_120s", {createDuration: "120s"}, {
* dependsOn: [folder],
* });
* const binding_for_all_folder_principals = new gcp.iam.FoldersPolicyBinding("binding-for-all-folder-principals", {
* folder: folder.folderId,
* location: "global",
* displayName: "binding for all principals in the folder",
* policyKind: "PRINCIPAL_ACCESS_BOUNDARY",
* policyBindingId: "binding-for-all-folder-principals",
* policy: pulumi.interpolate`organizations/123456789/locations/global/principalAccessBoundaryPolicies/${pabPolicy.principalAccessBoundaryPolicyId}`,
* target: {
* principalSet: pulumi.interpolate`//cloudresourcemanager.googleapis.com/folders/${folder.folderId}`,
* },
* }, {
* dependsOn: [wait120s],
* });
* ```
*
* ## Import
*
* FoldersPolicyBinding can be imported using any of these accepted formats:
*
* * `folders/{{folder}}/locations/{{location}}/policyBindings/{{policy_binding_id}}`
* * `{{folder}}/{{location}}/{{policy_binding_id}}`
*
* When using the `pulumi import` command, FoldersPolicyBinding can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:iam/foldersPolicyBinding:FoldersPolicyBinding default folders/{{folder}}/locations/{{location}}/policyBindings/{{policy_binding_id}}
* $ pulumi import gcp:iam/foldersPolicyBinding:FoldersPolicyBinding default {{folder}}/{{location}}/{{policy_binding_id}}
* ```
*/
class FoldersPolicyBinding extends pulumi.CustomResource {
/**
* Get an existing FoldersPolicyBinding 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 FoldersPolicyBinding(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:iam/foldersPolicyBinding:FoldersPolicyBinding';
/**
* Returns true if the given object is an instance of FoldersPolicyBinding. 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'] === FoldersPolicyBinding.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["annotations"] = state?.annotations;
resourceInputs["condition"] = state?.condition;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
resourceInputs["etag"] = state?.etag;
resourceInputs["folder"] = state?.folder;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["policy"] = state?.policy;
resourceInputs["policyBindingId"] = state?.policyBindingId;
resourceInputs["policyKind"] = state?.policyKind;
resourceInputs["policyUid"] = state?.policyUid;
resourceInputs["target"] = state?.target;
resourceInputs["uid"] = state?.uid;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.folder === undefined && !opts.urn) {
throw new Error("Missing required property 'folder'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.policy === undefined && !opts.urn) {
throw new Error("Missing required property 'policy'");
}
if (args?.policyBindingId === undefined && !opts.urn) {
throw new Error("Missing required property 'policyBindingId'");
}
if (args?.target === undefined && !opts.urn) {
throw new Error("Missing required property 'target'");
}
resourceInputs["annotations"] = args?.annotations;
resourceInputs["condition"] = args?.condition;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["folder"] = args?.folder;
resourceInputs["location"] = args?.location;
resourceInputs["policy"] = args?.policy;
resourceInputs["policyBindingId"] = args?.policyBindingId;
resourceInputs["policyKind"] = args?.policyKind;
resourceInputs["target"] = args?.target;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveAnnotations"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["policyUid"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(FoldersPolicyBinding.__pulumiType, name, resourceInputs, opts);
}
}
exports.FoldersPolicyBinding = FoldersPolicyBinding;
//# sourceMappingURL=foldersPolicyBinding.js.map