@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
104 lines • 4 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.User = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an IAM user.
*
* > *NOTE:* If policies are attached to the user via the `aws.iam.PolicyAttachment` resource and you are modifying the user `name` or `path`, the `forceDestroy` argument must be set to `true` and applied before attempting the operation otherwise you will encounter a `DeleteConflict` error. The `aws.iam.UserPolicyAttachment` resource (recommended) does not have this requirement.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const lb = new aws.iam.User("lb", {
* name: "loadbalancer",
* path: "/system/",
* tags: {
* "tag-key": "tag-value",
* },
* });
* const lbAccessKey = new aws.iam.AccessKey("lb", {user: lb.name});
* const lbRo = aws.iam.getPolicyDocument({
* statements: [{
* effect: "Allow",
* actions: ["ec2:Describe*"],
* resources: ["*"],
* }],
* });
* const lbRoUserPolicy = new aws.iam.UserPolicy("lb_ro", {
* name: "test",
* user: lb.name,
* policy: lbRo.then(lbRo => lbRo.json),
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import IAM Users using the `name`. For example:
*
* ```sh
* $ pulumi import aws:iam/user:User lb loadbalancer
* ```
*/
class User extends pulumi.CustomResource {
/**
* Get an existing User 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 User(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of User. 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'] === User.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["forceDestroy"] = state?.forceDestroy;
resourceInputs["name"] = state?.name;
resourceInputs["path"] = state?.path;
resourceInputs["permissionsBoundary"] = state?.permissionsBoundary;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["uniqueId"] = state?.uniqueId;
}
else {
const args = argsOrState;
resourceInputs["forceDestroy"] = args?.forceDestroy;
resourceInputs["name"] = args?.name;
resourceInputs["path"] = args?.path;
resourceInputs["permissionsBoundary"] = args?.permissionsBoundary;
resourceInputs["tags"] = args?.tags;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["uniqueId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(User.__pulumiType, name, resourceInputs, opts);
}
}
exports.User = User;
/** @internal */
User.__pulumiType = 'aws:iam/user:User';
//# sourceMappingURL=user.js.map