PrincipalAssociation
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.ResourceShareAccepterresource 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.ResourceShareAccepterresource to accept these invitations.
Example Usage
AWS Account ID
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceShare = new Aws.Ram.ResourceShare("exampleResourceShare", new Aws.Ram.ResourceShareArgs
{
AllowExternalPrincipals = true,
});
var examplePrincipalAssociation = new Aws.Ram.PrincipalAssociation("examplePrincipalAssociation", new Aws.Ram.PrincipalAssociationArgs
{
Principal = "111111111111",
ResourceShareArn = exampleResourceShare.Arn,
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ram"
"github.com/pulumi/pulumi/sdk/v2/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
})
}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("example", {
// ... other configuration ...
allowExternalPrincipals: true,
});
const examplePrincipalAssociation = new aws.ram.PrincipalAssociation("example", {
principal: "111111111111",
resourceShareArn: exampleResourceShare.arn,
});AWS Organization
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.Ram.PrincipalAssociation("example", new Aws.Ram.PrincipalAssociationArgs
{
Principal = aws_organizations_organization.Example.Arn,
ResourceShareArn = aws_ram_resource_share.Example.Arn,
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ram"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ram.NewPrincipalAssociation(ctx, "example", &ram.PrincipalAssociationArgs{
Principal: pulumi.String(aws_organizations_organization.Example.Arn),
ResourceShareArn: pulumi.String(aws_ram_resource_share.Example.Arn),
})
if err != nil {
return err
}
return nil
})
}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,
});Create a PrincipalAssociation Resource
new PrincipalAssociation(name: string, args: PrincipalAssociationArgs, opts?: CustomResourceOptions);def PrincipalAssociation(resource_name, opts=None, principal=None, resource_share_arn=None, __props__=None);func NewPrincipalAssociation(ctx *Context, name string, args PrincipalAssociationArgs, opts ...ResourceOption) (*PrincipalAssociation, error)public PrincipalAssociation(string name, PrincipalAssociationArgs args, CustomResourceOptions? opts = null)- 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.
- opts ResourceOptions
- A bag of options that control this 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.
PrincipalAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The PrincipalAssociation resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the PrincipalAssociation resource produces the following output properties:
Look up an 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): PrincipalAssociationstatic get(resource_name, id, opts=None, principal=None, resource_share_arn=None, __props__=None);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)- 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.
The following state arguments are supported:
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.