@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
103 lines • 4.44 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.IAMBinding = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Allows creation and management of a single binding within IAM policy for
* an existing Google Cloud Platform Organization.
*
* > **Note:** This resource __must not__ be used in conjunction with
* `gcp.organizations.IAMMember` for the __same role__ or they will fight over
* what your policy should be.
*
* > **Note:** On create, this resource will overwrite members of any existing roles.
* Use `pulumi import` and inspect the `output to ensure
* your existing members are preserved.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const binding = new gcp.organizations.IAMBinding("binding", {
* orgId: "123456789",
* role: "roles/browser",
* members: ["user:alice@gmail.com"],
* });
* ```
*
* ## Import
*
* IAM binding imports use space-delimited identifiers; first the resource in question and then the role. These bindings can be imported using the `org_id` and role, e.g.
*
* ```sh
* $ pulumi import gcp:organizations/iAMBinding:IAMBinding my_org "your-org-id roles/viewer"
* ```
*
* -> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
*
* full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
*/
class IAMBinding extends pulumi.CustomResource {
/**
* Get an existing IAMBinding 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 IAMBinding(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of IAMBinding. 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'] === IAMBinding.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["condition"] = state ? state.condition : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["members"] = state ? state.members : undefined;
resourceInputs["orgId"] = state ? state.orgId : undefined;
resourceInputs["role"] = state ? state.role : undefined;
}
else {
const args = argsOrState;
if ((!args || args.members === undefined) && !opts.urn) {
throw new Error("Missing required property 'members'");
}
if ((!args || args.orgId === undefined) && !opts.urn) {
throw new Error("Missing required property 'orgId'");
}
if ((!args || args.role === undefined) && !opts.urn) {
throw new Error("Missing required property 'role'");
}
resourceInputs["condition"] = args ? args.condition : undefined;
resourceInputs["members"] = args ? args.members : undefined;
resourceInputs["orgId"] = args ? args.orgId : undefined;
resourceInputs["role"] = args ? args.role : undefined;
resourceInputs["etag"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(IAMBinding.__pulumiType, name, resourceInputs, opts);
}
}
exports.IAMBinding = IAMBinding;
/** @internal */
IAMBinding.__pulumiType = 'gcp:organizations/iAMBinding:IAMBinding';
//# sourceMappingURL=iambinding.js.map