Class PrincipalAssociation


  • public class PrincipalAssociation
    extends com.pulumi.resources.CustomResource
    Provides a Resource Access Manager (RAM) principal association. Depending if [RAM Sharing with AWS Organizations is enabled](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-sharing.html#getting-started-sharing-orgs), the RAM behavior with different principal types changes. When RAM Sharing with AWS Organizations is enabled: - For AWS Account ID, Organization, and Organizational Unit principals within the same AWS Organization, no resource share invitation is sent and resources become available automatically after creating the association. - For AWS Account ID principals outside the AWS Organization, a resource share invitation is sent and must be accepted before resources become available. See the `aws.ram.ResourceShareAccepter` resource to accept these invitations. When RAM Sharing with AWS Organizations is not enabled: - Organization and Organizational Unit principals cannot be used. - For AWS Account ID principals, a resource share invitation is sent and must be accepted before resources become available. See the `aws.ram.ResourceShareAccepter` resource to accept these invitations. ## Example Usage ### AWS Account ID
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ram.ResourceShare;
     import com.pulumi.aws.ram.ResourceShareArgs;
     import com.pulumi.aws.ram.PrincipalAssociation;
     import com.pulumi.aws.ram.PrincipalAssociationArgs;
     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 ResourceShare("example", ResourceShareArgs.builder()
                 .allowExternalPrincipals(true)
                 .build());
     
             var examplePrincipalAssociation = new PrincipalAssociation("examplePrincipalAssociation", PrincipalAssociationArgs.builder()
                 .principal("111111111111")
                 .resourceShareArn(example.arn())
                 .build());
     
         }
     }
     
     
    ### AWS Organization
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ram.PrincipalAssociation;
     import com.pulumi.aws.ram.PrincipalAssociationArgs;
     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 PrincipalAssociation("example", PrincipalAssociationArgs.builder()
                 .principal(exampleAwsOrganizationsOrganization.arn())
                 .resourceShareArn(exampleAwsRamResourceShare.arn())
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `principal` (String) Principal associated with the resource share. * `resourceShareArn` (String) ARN of the resource share. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import RAM Principal Associations using their Resource Share ARN and the `principal` separated by a comma. For example: ```sh $ pulumi import aws:ram/principalAssociation:PrincipalAssociation example arn:aws:ram:eu-west-1:123456789012:resource-share/73da1ab9-b94a-4ba3-8eb4-45917f7f4b12,123456789012 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static PrincipalAssociation get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, PrincipalAssociationState 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.lang.String> principal()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> resourceShareArn()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrincipalAssociation

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

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

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

      • principal

        public com.pulumi.core.Output<java.lang.String> principal()
        Returns:
        Principal to associate with the resource share. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN.
      • 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.
      • resourceShareArn

        public com.pulumi.core.Output<java.lang.String> resourceShareArn()
        Returns:
        ARN of the resource share.
      • get

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