Try AWS Native preview for resources not in the classic version.
aws.ram.PrincipalAssociation
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides a Resource Access Manager (RAM) principal association. Depending if RAM Sharing with AWS Organizations is enabled, 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
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleResourceShare = new Aws.Ram.ResourceShare("exampleResourceShare", new()
{
AllowExternalPrincipals = true,
});
var examplePrincipalAssociation = new Aws.Ram.PrincipalAssociation("examplePrincipalAssociation", new()
{
Principal = "111111111111",
ResourceShareArn = exampleResourceShare.Arn,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ram"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceShare, err := ram.NewResourceShare(ctx, "exampleResourceShare", &ram.ResourceShareArgs{
AllowExternalPrincipals: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = ram.NewPrincipalAssociation(ctx, "examplePrincipalAssociation", &ram.PrincipalAssociationArgs{
Principal: pulumi.String("111111111111"),
ResourceShareArn: exampleResourceShare.Arn,
})
if err != nil {
return err
}
return nil
})
}
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.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 exampleResourceShare = new ResourceShare("exampleResourceShare", ResourceShareArgs.builder()
.allowExternalPrincipals(true)
.build());
var examplePrincipalAssociation = new PrincipalAssociation("examplePrincipalAssociation", PrincipalAssociationArgs.builder()
.principal("111111111111")
.resourceShareArn(exampleResourceShare.arn())
.build());
}
}
import pulumi
import pulumi_aws as aws
example_resource_share = aws.ram.ResourceShare("exampleResourceShare", allow_external_principals=True)
example_principal_association = aws.ram.PrincipalAssociation("examplePrincipalAssociation",
principal="111111111111",
resource_share_arn=example_resource_share.arn)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleResourceShare = new aws.ram.ResourceShare("exampleResourceShare", {allowExternalPrincipals: true});
const examplePrincipalAssociation = new aws.ram.PrincipalAssociation("examplePrincipalAssociation", {
principal: "111111111111",
resourceShareArn: exampleResourceShare.arn,
});
resources:
exampleResourceShare:
type: aws:ram:ResourceShare
properties:
# ... other configuration ...
allowExternalPrincipals: true
examplePrincipalAssociation:
type: aws:ram:PrincipalAssociation
properties:
principal: '111111111111'
resourceShareArn: ${exampleResourceShare.arn}
AWS Organization
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ram.PrincipalAssociation("example", new()
{
Principal = aws_organizations_organization.Example.Arn,
ResourceShareArn = aws_ram_resource_share.Example.Arn,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ram"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ram.NewPrincipalAssociation(ctx, "example", &ram.PrincipalAssociationArgs{
Principal: pulumi.Any(aws_organizations_organization.Example.Arn),
ResourceShareArn: pulumi.Any(aws_ram_resource_share.Example.Arn),
})
if err != nil {
return err
}
return nil
})
}
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.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 example = new PrincipalAssociation("example", PrincipalAssociationArgs.builder()
.principal(aws_organizations_organization.example().arn())
.resourceShareArn(aws_ram_resource_share.example().arn())
.build());
}
}
import pulumi
import pulumi_aws as aws
example = aws.ram.PrincipalAssociation("example",
principal=aws_organizations_organization["example"]["arn"],
resource_share_arn=aws_ram_resource_share["example"]["arn"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ram.PrincipalAssociation("example", {
principal: aws_organizations_organization.example.arn,
resourceShareArn: aws_ram_resource_share.example.arn,
});
resources:
example:
type: aws:ram:PrincipalAssociation
properties:
principal: ${aws_organizations_organization.example.arn}
resourceShareArn: ${aws_ram_resource_share.example.arn}
Create PrincipalAssociation Resource
new PrincipalAssociation(name: string, args: PrincipalAssociationArgs, opts?: CustomResourceOptions);
@overload
def PrincipalAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
principal: Optional[str] = None,
resource_share_arn: Optional[str] = None)
@overload
def PrincipalAssociation(resource_name: str,
args: PrincipalAssociationArgs,
opts: Optional[ResourceOptions] = None)
func NewPrincipalAssociation(ctx *Context, name string, args PrincipalAssociationArgs, opts ...ResourceOption) (*PrincipalAssociation, error)
public PrincipalAssociation(string name, PrincipalAssociationArgs args, CustomResourceOptions? opts = null)
public PrincipalAssociation(String name, PrincipalAssociationArgs args)
public PrincipalAssociation(String name, PrincipalAssociationArgs args, CustomResourceOptions options)
type: aws:ram:PrincipalAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PrincipalAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args PrincipalAssociationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PrincipalAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PrincipalAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PrincipalAssociationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
PrincipalAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The PrincipalAssociation resource accepts the following input properties:
- Principal string
The 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.
- string
The Amazon Resource Name (ARN) of the resource share.
- Principal string
The 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.
- string
The Amazon Resource Name (ARN) of the resource share.
- principal String
The 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.
- String
The Amazon Resource Name (ARN) of the resource share.
- principal string
The 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.
- string
The Amazon Resource Name (ARN) of the resource share.
- principal str
The 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.
- str
The Amazon Resource Name (ARN) of the resource share.
- principal String
The 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.
- String
The Amazon Resource Name (ARN) of the resource share.
Outputs
All input properties are implicitly available as output properties. Additionally, the PrincipalAssociation resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing PrincipalAssociation Resource
Get an existing PrincipalAssociation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PrincipalAssociationState, opts?: CustomResourceOptions): PrincipalAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
principal: Optional[str] = None,
resource_share_arn: Optional[str] = None) -> PrincipalAssociation
func GetPrincipalAssociation(ctx *Context, name string, id IDInput, state *PrincipalAssociationState, opts ...ResourceOption) (*PrincipalAssociation, error)
public static PrincipalAssociation Get(string name, Input<string> id, PrincipalAssociationState? state, CustomResourceOptions? opts = null)
public static PrincipalAssociation get(String name, Output<String> id, PrincipalAssociationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Principal string
The 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.
- string
The Amazon Resource Name (ARN) of the resource share.
- Principal string
The 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.
- string
The Amazon Resource Name (ARN) of the resource share.
- principal String
The 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.
- String
The Amazon Resource Name (ARN) of the resource share.
- principal string
The 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.
- string
The Amazon Resource Name (ARN) of the resource share.
- principal str
The 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.
- str
The Amazon Resource Name (ARN) of the resource share.
- principal String
The 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.
- String
The Amazon Resource Name (ARN) of the resource share.
Import
RAM Principal Associations can be imported using their Resource Share ARN and the principal
separated by a comma, e.g.,
$ pulumi import aws:ram/principalAssociation:PrincipalAssociation example arn:aws:ram:eu-west-1:123456789012:resource-share/73da1ab9-b94a-4ba3-8eb4-45917f7f4b12,123456789012
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.