UserPolicyAttachmentArgs

data class UserPolicyAttachmentArgs(val policyArn: Output<String>? = null, val user: Output<String>? = null) : ConvertibleToJava<UserPolicyAttachmentArgs>

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

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.User;
import com.pulumi.aws.iam.Policy;
import com.pulumi.aws.iam.PolicyArgs;
import com.pulumi.aws.iam.UserPolicyAttachment;
import com.pulumi.aws.iam.UserPolicyAttachmentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var user = new User("user");
var policy = new Policy("policy", PolicyArgs.builder()
.description("A test policy")
.policy("{ ... policy JSON ... }")
.build());
var test_attach = new UserPolicyAttachment("test-attach", UserPolicyAttachmentArgs.builder()
.user(user.name())
.policyArn(policy.arn())
.build());
}
}

Import

IAM user policy attachments can be imported using the user name and policy arn separated by /.

$ pulumi import aws:iam/userPolicyAttachment:UserPolicyAttachment test-attach test-user/arn:aws:iam::xxxxxxxxxxxx:policy/test-policy

Constructors

Link copied to clipboard
constructor(policyArn: Output<String>? = null, user: Output<String>? = null)

Properties

Link copied to clipboard
val policyArn: Output<String>? = null

The ARN of the policy you want to apply

Link copied to clipboard
val user: Output<String>? = null

The user the policy should be applied to

Functions

Link copied to clipboard
open override fun toJava(): UserPolicyAttachmentArgs