@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
88 lines • 3.6 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.GroupMembership = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* > **WARNING:** Multiple aws.iam.GroupMembership resources with the same group name will produce inconsistent behavior!
*
* Provides a top level resource to manage IAM Group membership for IAM Users. For
* more information on managing IAM Groups or IAM Users, see IAM Groups or
* IAM Users
*
* > **Note:** `aws.iam.GroupMembership` will conflict with itself if used more than once with the same group. To non-exclusively manage the users in a group, see the
* `aws.iam.UserGroupMembership` resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const group = new aws.iam.Group("group", {name: "test-group"});
* const userOne = new aws.iam.User("user_one", {name: "test-user"});
* const userTwo = new aws.iam.User("user_two", {name: "test-user-two"});
* const team = new aws.iam.GroupMembership("team", {
* name: "tf-testing-group-membership",
* users: [
* userOne.name,
* userTwo.name,
* ],
* group: group.name,
* });
* ```
*/
class GroupMembership extends pulumi.CustomResource {
/**
* Get an existing GroupMembership 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 GroupMembership(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of GroupMembership. 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'] === GroupMembership.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["group"] = state?.group;
resourceInputs["name"] = state?.name;
resourceInputs["users"] = state?.users;
}
else {
const args = argsOrState;
if (args?.group === undefined && !opts.urn) {
throw new Error("Missing required property 'group'");
}
if (args?.users === undefined && !opts.urn) {
throw new Error("Missing required property 'users'");
}
resourceInputs["group"] = args?.group;
resourceInputs["name"] = args?.name;
resourceInputs["users"] = args?.users;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GroupMembership.__pulumiType, name, resourceInputs, opts);
}
}
exports.GroupMembership = GroupMembership;
/** @internal */
GroupMembership.__pulumiType = 'aws:iam/groupMembership:GroupMembership';
//# sourceMappingURL=groupMembership.js.map
;