Package com.pulumi.aws.iam
Class RolePolicyAttachmentsExclusive
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.iam.RolePolicyAttachmentsExclusive
-
public class RolePolicyAttachmentsExclusive extends com.pulumi.resources.CustomResource> **NOTE:**: To reliably detect drift between customer managed policies listed in this resource and actual policies attached to the role in the cloud, you currently need to run Pulumi with `pulumi up --refresh`. See [#4766](https://github.com/pulumi/pulumi-aws/issues/4766) for tracking making this work with regular `pulumi up` Resource for maintaining exclusive management of managed IAM policies assigned to an AWS IAM (Identity & Access Management) role. > This resource takes exclusive ownership over managed IAM policies attached to a role. This includes removal of managed IAM policies which are not explicitly configured. To prevent persistent drift, ensure any `aws.iam.RolePolicyAttachment` resources managed alongside this resource are included in the `policyArns` argument. > Destruction of this resource means Pulumi will no longer manage reconciliation of the configured policy attachments. It **will not** detach the configured policies from the role. ## 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 role via Pulumi (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.RolePolicyAttachmentsExclusive; import com.pulumi.aws.iam.RolePolicyAttachmentsExclusiveArgs; 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 RolePolicyAttachmentsExclusive("example", RolePolicyAttachmentsExclusiveArgs.builder() .roleName(exampleAwsIamRole.name()) .policyArns(exampleAwsIamPolicy.arn()) .build()); } }
## Import Using `pulumi import`, import exclusive management of managed IAM policy assignments using the `roleName`. For example: ```sh $ pulumi import aws:iam/rolePolicyAttachmentsExclusive:RolePolicyAttachmentsExclusive example MyRole ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.iam.RolePolicyAttachmentsExclusive; import com.pulumi.aws.iam.RolePolicyAttachmentsExclusiveArgs; 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 RolePolicyAttachmentsExclusive("example", RolePolicyAttachmentsExclusiveArgs.builder() .roleName(exampleAwsIamRole.name()) .policyArns() .build()); } }
-
-
Constructor Summary
Constructors Constructor Description RolePolicyAttachmentsExclusive(java.lang.String name)RolePolicyAttachmentsExclusive(java.lang.String name, RolePolicyAttachmentsExclusiveArgs args)RolePolicyAttachmentsExclusive(java.lang.String name, RolePolicyAttachmentsExclusiveArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RolePolicyAttachmentsExclusiveget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, RolePolicyAttachmentsExclusiveState 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>roleName()
-
-
-
Constructor Detail
-
RolePolicyAttachmentsExclusive
public RolePolicyAttachmentsExclusive(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
RolePolicyAttachmentsExclusive
public RolePolicyAttachmentsExclusive(java.lang.String name, RolePolicyAttachmentsExclusiveArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
RolePolicyAttachmentsExclusive
public RolePolicyAttachmentsExclusive(java.lang.String name, RolePolicyAttachmentsExclusiveArgs 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 role. Policies attached to this role but not configured in this argument will be removed.
-
roleName
public com.pulumi.core.Output<java.lang.String> roleName()
- Returns:
- IAM role name.
-
get
public static RolePolicyAttachmentsExclusive get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable RolePolicyAttachmentsExclusiveState 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.
-
-