@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
97 lines • 4.25 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.IamMemberRemove = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Ensures that a member:role pairing does not exist in a project's IAM policy.
*
* On create, this resource will modify the policy to remove the `member` from the
* `role`. If the membership is ever re-added, the next refresh will clear this
* resource from state, proposing re-adding it to correct the membership. Import is
* not supported- this resource will acquire the current policy and modify it as
* part of creating the resource.
*
* This resource will conflict with `gcp.projects.IAMPolicy` and
* `gcp.projects.IAMBinding` resources that share a role, as well as
* `gcp.projects.IAMMember` resources that target the same membership. When
* multiple resources conflict the final state is not guaranteed to include or omit
* the membership. Subsequent `pulumi up` calls will always show a diff
* until the configuration is corrected.
*
* For more information see
* [the official documentation](https://cloud.google.com/iam/docs/granting-changing-revoking-access)
* and
* [API reference](https://cloud.google.com/resource-manager/reference/rest/v1/projects/setIamPolicy).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const targetProject = gcp.organizations.getProject({});
* const foo = new gcp.projects.IamMemberRemove("foo", {
* role: "roles/editor",
* project: targetProjectGoogleProject.projectId,
* member: `serviceAccount:${targetProjectGoogleProject.number}-compute@developer.gserviceaccount.com`,
* });
* ```
*/
class IamMemberRemove extends pulumi.CustomResource {
/**
* Get an existing IamMemberRemove 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 IamMemberRemove(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of IamMemberRemove. 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'] === IamMemberRemove.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["member"] = state?.member;
resourceInputs["project"] = state?.project;
resourceInputs["role"] = state?.role;
}
else {
const args = argsOrState;
if (args?.member === undefined && !opts.urn) {
throw new Error("Missing required property 'member'");
}
if (args?.project === undefined && !opts.urn) {
throw new Error("Missing required property 'project'");
}
if (args?.role === undefined && !opts.urn) {
throw new Error("Missing required property 'role'");
}
resourceInputs["member"] = args?.member;
resourceInputs["project"] = args?.project;
resourceInputs["role"] = args?.role;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(IamMemberRemove.__pulumiType, name, resourceInputs, opts);
}
}
exports.IamMemberRemove = IamMemberRemove;
/** @internal */
IamMemberRemove.__pulumiType = 'gcp:projects/iamMemberRemove:IamMemberRemove';
//# sourceMappingURL=iamMemberRemove.js.map
;