Class CustomerManagedPolicyAttachmentsExclusive


  • public class CustomerManagedPolicyAttachmentsExclusive
    extends com.pulumi.resources.CustomResource
    Resource for managing exclusive AWS SSO Admin Customer Managed Policy Attachments. This resource is designed to manage all customer managed policy attachments for an SSO permission set. Using this resource, Terraform will remove any customer managed policies attached to the permission set that are not defined in the configuration. > **WARNING:** Do not use this resource together with the `aws.ssoadmin.CustomerManagedPolicyAttachment` resource for the same permission set. Doing so will cause a conflict and will lead to customer managed policies being removed. > Destruction of this resource means Terraform will no longer manage the customer managed policy attachments, **but will not detach any policies**. The permission set will retain all customer managed policies that were attached at the time of destruction. ## Example Usage ### Basic Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ssoadmin.SsoadminFunctions;
     import com.pulumi.aws.ssoadmin.inputs.GetInstancesArgs;
     import com.pulumi.aws.ssoadmin.PermissionSet;
     import com.pulumi.aws.ssoadmin.PermissionSetArgs;
     import com.pulumi.aws.iam.Policy;
     import com.pulumi.aws.iam.PolicyArgs;
     import com.pulumi.aws.ssoadmin.CustomerManagedPolicyAttachmentsExclusive;
     import com.pulumi.aws.ssoadmin.CustomerManagedPolicyAttachmentsExclusiveArgs;
     import com.pulumi.aws.ssoadmin.inputs.CustomerManagedPolicyAttachmentsExclusiveCustomerManagedPolicyReferenceArgs;
     import static com.pulumi.codegen.internal.Serialization.*;
     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) {
             final var example = SsoadminFunctions.getInstances(GetInstancesArgs.builder()
                 .build());
     
             var examplePermissionSet = new PermissionSet("examplePermissionSet", PermissionSetArgs.builder()
                 .name("Example")
                 .instanceArn(example.arns()[0])
                 .build());
     
             var examplePolicy = new Policy("examplePolicy", PolicyArgs.builder()
                 .name("TestPolicy")
                 .description("My test policy")
                 .policy(serializeJson(
                     jsonObject(
                         jsonProperty("Version", "2012-10-17"),
                         jsonProperty("Statement", jsonArray(jsonObject(
                             jsonProperty("Action", jsonArray("ec2:Describe*")),
                             jsonProperty("Effect", "Allow"),
                             jsonProperty("Resource", "*")
                         )))
                     )))
                 .build());
     
             var exampleCustomerManagedPolicyAttachmentsExclusive = new CustomerManagedPolicyAttachmentsExclusive("exampleCustomerManagedPolicyAttachmentsExclusive", CustomerManagedPolicyAttachmentsExclusiveArgs.builder()
                 .customerManagedPolicyReferences(CustomerManagedPolicyAttachmentsExclusiveCustomerManagedPolicyReferenceArgs.builder()
                     .name(examplePolicy.name())
                     .path("/")
                     .build())
                 .instanceArn(example.arns()[0])
                 .permissionSetArn(examplePermissionSet.arn())
                 .build());
     
         }
     }
     
     
    ### Disallow Customer Managed Policy Attachments To disallow all customer managed policy attachments, omit the `customerManagedPolicyReference` block. > Any customer managed policies attached to the permission set will be **removed**.
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ssoadmin.CustomerManagedPolicyAttachmentsExclusive;
     import com.pulumi.aws.ssoadmin.CustomerManagedPolicyAttachmentsExclusiveArgs;
     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 CustomerManagedPolicyAttachmentsExclusive("example", CustomerManagedPolicyAttachmentsExclusiveArgs.builder()
                 .instanceArn(exampleAwsSsoadminInstances.arns()[0])
                 .permissionSetArn(exampleAwsSsoadminPermissionSet.arn())
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `instanceArn` (String) ARN of the SSO Instance. * `permissionSetArn` (String) ARN of the Permission Set. #### Optional * `accountId` (String) Account ID where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import SSO Admin Customer Managed Policy Attachments Exclusive using the `instanceArn` and `permissionSetArn` arguments, separated by a comma (`,`). For example: ```sh $ pulumi import aws:ssoadmin/customerManagedPolicyAttachmentsExclusive:CustomerManagedPolicyAttachmentsExclusive example arn:aws:sso:::instance/ssoins-1234567890abcdef,arn:aws:sso:::permissionSet/ssoins-1234567890abcdef/ps-1234567890abcdef ```
    • Constructor Detail

      • CustomerManagedPolicyAttachmentsExclusive

        public CustomerManagedPolicyAttachmentsExclusive​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • CustomerManagedPolicyAttachmentsExclusive

        public CustomerManagedPolicyAttachmentsExclusive​(java.lang.String name,
                                                         CustomerManagedPolicyAttachmentsExclusiveArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • CustomerManagedPolicyAttachmentsExclusive

        public CustomerManagedPolicyAttachmentsExclusive​(java.lang.String name,
                                                         CustomerManagedPolicyAttachmentsExclusiveArgs 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

      • instanceArn

        public com.pulumi.core.Output<java.lang.String> instanceArn()
        Returns:
        ARN of the SSO Instance.
      • permissionSetArn

        public com.pulumi.core.Output<java.lang.String> permissionSetArn()
        Returns:
        ARN of the Permission Set. The following arguments are optional:
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • get

        public static CustomerManagedPolicyAttachmentsExclusive get​(java.lang.String name,
                                                                    com.pulumi.core.Output<java.lang.String> id,
                                                                    @Nullable
                                                                    CustomerManagedPolicyAttachmentsExclusiveState 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.