@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
93 lines (92 loc) • 3.37 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import { User } from "./index";
/**
* Attaches a Managed IAM Policy to an IAM user
*
* > **NOTE:** The usage of this resource conflicts with the `aws.iam.PolicyAttachment` resource and will permanently show a difference if both are defined.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const user = new aws.iam.User("user", {name: "test-user"});
* const policy = new aws.iam.Policy("policy", {
* name: "test-policy",
* description: "A test policy",
* policy: "{ ... policy JSON ... }",
* });
* const test_attach = new aws.iam.UserPolicyAttachment("test-attach", {
* user: user.name,
* policyArn: policy.arn,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import IAM user policy attachments using the user name and policy arn separated by `/`. For example:
*
* ```sh
* $ pulumi import aws:iam/userPolicyAttachment:UserPolicyAttachment test-attach test-user/arn:aws:iam::xxxxxxxxxxxx:policy/test-policy
* ```
*/
export declare class UserPolicyAttachment extends pulumi.CustomResource {
/**
* Get an existing UserPolicyAttachment 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: string, id: pulumi.Input<pulumi.ID>, state?: UserPolicyAttachmentState, opts?: pulumi.CustomResourceOptions): UserPolicyAttachment;
/**
* Returns true if the given object is an instance of UserPolicyAttachment. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is UserPolicyAttachment;
/**
* The ARN of the policy you want to apply
*/
readonly policyArn: pulumi.Output<string>;
/**
* The user the policy should be applied to
*/
readonly user: pulumi.Output<string>;
/**
* Create a UserPolicyAttachment resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: UserPolicyAttachmentArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering UserPolicyAttachment resources.
*/
export interface UserPolicyAttachmentState {
/**
* The ARN of the policy you want to apply
*/
policyArn?: pulumi.Input<string>;
/**
* The user the policy should be applied to
*/
user?: pulumi.Input<string | User>;
}
/**
* The set of arguments for constructing a UserPolicyAttachment resource.
*/
export interface UserPolicyAttachmentArgs {
/**
* The ARN of the policy you want to apply
*/
policyArn: pulumi.Input<string>;
/**
* The user the policy should be applied to
*/
user: pulumi.Input<string | User>;
}