Package com.pulumi.aws.iam
Class UserPolicyAttachmentsExclusive
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.iam.UserPolicyAttachmentsExclusive
-
public class UserPolicyAttachmentsExclusive extends com.pulumi.resources.CustomResourceResource for maintaining exclusive management of managed IAM policies assigned to an AWS IAM (Identity & Access Management) user. > This resource takes exclusive ownership over managed IAM policies attached to a user. This includes removal of managed IAM policies which are not explicitly configured. To prevent persistent drift, ensure any `aws.iam.UserPolicyAttachment` resources managed alongside this resource are included in the `policyArns` argument. > Destruction of this resource means Terraform will no longer manage reconciliation of the configured policy attachments. It **will not** detach the configured policies from the user. ## Example Usage ### Basic Usage
### Disallow Managed IAM Policies To automatically remove any configured managed IAM policies, set the `policyArns` argument to an empty list. > This will not **prevent** managed IAM policies from being assigned to a user via Terraform (or any other interface). This resource enables bringing managed IAM policy assignments into a configured state, however, this reconciliation happens only when `apply` is proactively run.package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.iam.UserPolicyAttachmentsExclusive; import com.pulumi.aws.iam.UserPolicyAttachmentsExclusiveArgs; import java.util.ArrayList; import java.util.Arrays; 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 example = new UserPolicyAttachmentsExclusive("example", UserPolicyAttachmentsExclusiveArgs.builder() .userName(exampleAwsIamUser.name()) .policyArns(exampleAwsIamPolicy.arn()) .build()); } }
## Import Using `pulumi import`, import exclusive management of managed IAM policy assignments using the `userName`. For example: ```sh $ pulumi import aws:iam/userPolicyAttachmentsExclusive:UserPolicyAttachmentsExclusive example MyUser ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.iam.UserPolicyAttachmentsExclusive; import com.pulumi.aws.iam.UserPolicyAttachmentsExclusiveArgs; import java.util.ArrayList; import java.util.Arrays; 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 example = new UserPolicyAttachmentsExclusive("example", UserPolicyAttachmentsExclusiveArgs.builder() .userName(exampleAwsIamUser.name()) .policyArns() .build()); } }
-
-
Constructor Summary
Constructors Constructor Description UserPolicyAttachmentsExclusive(java.lang.String name)UserPolicyAttachmentsExclusive(java.lang.String name, UserPolicyAttachmentsExclusiveArgs args)UserPolicyAttachmentsExclusive(java.lang.String name, UserPolicyAttachmentsExclusiveArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UserPolicyAttachmentsExclusiveget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, UserPolicyAttachmentsExclusiveState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.List<java.lang.String>>policyArns()com.pulumi.core.Output<java.lang.String>userName()
-
-
-
Constructor Detail
-
UserPolicyAttachmentsExclusive
public UserPolicyAttachmentsExclusive(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
UserPolicyAttachmentsExclusive
public UserPolicyAttachmentsExclusive(java.lang.String name, UserPolicyAttachmentsExclusiveArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
UserPolicyAttachmentsExclusive
public UserPolicyAttachmentsExclusive(java.lang.String name, UserPolicyAttachmentsExclusiveArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
policyArns
public com.pulumi.core.Output<java.util.List<java.lang.String>> policyArns()
- Returns:
- A list of managed IAM policy ARNs to be attached to the user. Policies attached to this user but not configured in this argument will be removed.
-
userName
public com.pulumi.core.Output<java.lang.String> userName()
- Returns:
- IAM user name.
-
get
public static UserPolicyAttachmentsExclusive get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable UserPolicyAttachmentsExclusiveState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-