@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
178 lines • 8.84 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.PrincipalAccessBoundaryPolicy = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* An IAM Principal Access Boundary Policy resource. This resource has no effect on accesses until is bound to a target through policy bindings.
* You can see further documentation on policy bindings in:
* - [Organizations](https://www.terraform.io/providers/hashicorp/google/latest/docs/resources/iam_organizations_policy_binding)
* - [Folders](https://www.terraform.io/providers/hashicorp/google/latest/docs/resources/iam_folders_policy_binding)
* - [Projects](https://www.terraform.io/providers/hashicorp/google/latest/docs/resources/iam_projects_policy_binding)
*
* To get more information about PrincipalAccessBoundaryPolicy, see:
*
* * [API documentation](https://cloud.google.com/iam/docs/reference/rest/v3/organizations.locations.principalAccessBoundaryPolicies)
* * How-to Guides
* * [Create and apply Principal Access Boundaries](https://cloud.google.com/iam/docs/principal-access-boundary-policies-create)
*
* ## Example Usage
*
* ### Iam Principal Access Boundary Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const pab_policy_for_org = new gcp.iam.PrincipalAccessBoundaryPolicy("pab-policy-for-org", {
* organization: "123456789",
* location: "global",
* displayName: "PAB policy for Organization",
* principalAccessBoundaryPolicyId: "pab-policy-for-org",
* });
* ```
* ### Iam Organizations 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 Organization",
* principalAccessBoundaryPolicyId: "my-pab-policy",
* });
* const wait60Seconds = new time.Sleep("wait_60_seconds", {createDuration: "60s"}, {
* dependsOn: [pabPolicy],
* });
* const my_pab_policy = new gcp.iam.OrganizationsPolicyBinding("my-pab-policy", {
* organization: "123456789",
* location: "global",
* displayName: "Binding for all principals in the Organization",
* policyKind: "PRINCIPAL_ACCESS_BOUNDARY",
* policyBindingId: "binding-for-all-org-principals",
* policy: pulumi.interpolate`organizations/123456789/locations/global/principalAccessBoundaryPolicies/${pabPolicy.principalAccessBoundaryPolicyId}`,
* target: {
* principalSet: "//cloudresourcemanager.googleapis.com/organizations/123456789",
* },
* }, {
* dependsOn: [wait60Seconds],
* });
* ```
*
* ## Import
*
* PrincipalAccessBoundaryPolicy can be imported using any of these accepted formats:
*
* * `organizations/{{organization}}/locations/{{location}}/principalAccessBoundaryPolicies/{{principal_access_boundary_policy_id}}`
* * `{{organization}}/{{location}}/{{principal_access_boundary_policy_id}}`
*
* When using the `pulumi import` command, PrincipalAccessBoundaryPolicy can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:iam/principalAccessBoundaryPolicy:PrincipalAccessBoundaryPolicy default organizations/{{organization}}/locations/{{location}}/principalAccessBoundaryPolicies/{{principal_access_boundary_policy_id}}
* $ pulumi import gcp:iam/principalAccessBoundaryPolicy:PrincipalAccessBoundaryPolicy default {{organization}}/{{location}}/{{principal_access_boundary_policy_id}}
* ```
*/
class PrincipalAccessBoundaryPolicy extends pulumi.CustomResource {
/**
* Get an existing PrincipalAccessBoundaryPolicy 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 PrincipalAccessBoundaryPolicy(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:iam/principalAccessBoundaryPolicy:PrincipalAccessBoundaryPolicy';
/**
* Returns true if the given object is an instance of PrincipalAccessBoundaryPolicy. 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'] === PrincipalAccessBoundaryPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["annotations"] = state?.annotations;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["details"] = state?.details;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
resourceInputs["etag"] = state?.etag;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["organization"] = state?.organization;
resourceInputs["principalAccessBoundaryPolicyId"] = state?.principalAccessBoundaryPolicyId;
resourceInputs["uid"] = state?.uid;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.organization === undefined && !opts.urn) {
throw new Error("Missing required property 'organization'");
}
if (args?.principalAccessBoundaryPolicyId === undefined && !opts.urn) {
throw new Error("Missing required property 'principalAccessBoundaryPolicyId'");
}
resourceInputs["annotations"] = args?.annotations;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["details"] = args?.details;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["location"] = args?.location;
resourceInputs["organization"] = args?.organization;
resourceInputs["principalAccessBoundaryPolicyId"] = args?.principalAccessBoundaryPolicyId;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveAnnotations"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PrincipalAccessBoundaryPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.PrincipalAccessBoundaryPolicy = PrincipalAccessBoundaryPolicy;
//# sourceMappingURL=principalAccessBoundaryPolicy.js.map