@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
139 lines • 6.16 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.IAMCustomRole = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Allows management of a customized Cloud IAM organization role. For more information see
* [the official documentation](https://cloud.google.com/iam/docs/understanding-custom-roles)
* and
* [API](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
*
* > **Warning:** Note that custom roles in GCP have the concept of a soft-delete. There are two issues that may arise
* from this and how roles are propagated. 1) creating a role may involve undeleting and then updating a role with the
* same name, possibly causing confusing behavior between undelete and update. 2) A deleted role is permanently deleted
* after 7 days, but it can take up to 30 more days (i.e. between 7 and 37 days after deletion) before the role name is
* made available again. This means a deleted role that has been deleted for more than 7 days cannot be changed at all
* by the provider, and new roles cannot share that name.
*
* ## Example Usage
*
* This snippet creates a customized IAM organization role.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const my_custom_role = new gcp.organizations.IAMCustomRole("my-custom-role", {
* roleId: "myCustomRole",
* orgId: "123456789",
* title: "My Custom Role",
* description: "A description",
* permissions: [
* "iam.roles.list",
* "iam.roles.create",
* "iam.roles.delete",
* ],
* });
* ```
*
* ## Import
*
* Customized IAM organization role can be imported using their URI, e.g.
*
* ```sh
* $ pulumi import gcp:organizations/iAMCustomRole:IAMCustomRole my-custom-role organizations/123456789/roles/myCustomRole
* ```
*/
class IAMCustomRole extends pulumi.CustomResource {
/**
* Get an existing IAMCustomRole 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 IAMCustomRole(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:organizations/iAMCustomRole:IAMCustomRole';
/**
* Returns true if the given object is an instance of IAMCustomRole. 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'] === IAMCustomRole.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["deleted"] = state?.deleted;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["name"] = state?.name;
resourceInputs["orgId"] = state?.orgId;
resourceInputs["permissions"] = state?.permissions;
resourceInputs["roleId"] = state?.roleId;
resourceInputs["stage"] = state?.stage;
resourceInputs["title"] = state?.title;
}
else {
const args = argsOrState;
if (args?.orgId === undefined && !opts.urn) {
throw new Error("Missing required property 'orgId'");
}
if (args?.permissions === undefined && !opts.urn) {
throw new Error("Missing required property 'permissions'");
}
if (args?.title === undefined && !opts.urn) {
throw new Error("Missing required property 'title'");
}
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["orgId"] = args?.orgId;
resourceInputs["permissions"] = args?.permissions;
resourceInputs["roleId"] = args?.roleId;
resourceInputs["stage"] = args?.stage;
resourceInputs["title"] = args?.title;
resourceInputs["deleted"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(IAMCustomRole.__pulumiType, name, resourceInputs, opts);
}
}
exports.IAMCustomRole = IAMCustomRole;
//# sourceMappingURL=iamcustomRole.js.map