Resource: aws_ram_principal_association

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:

When RAM Sharing with AWS Organizations is not enabled:

Example Usage

AWS Account ID

resource "aws_ram_resource_share" "example" {
  # ... other configuration ...
  allow_external_principals = true
}

resource "aws_ram_principal_association" "example" {
  principal          = "111111111111"
  resource_share_arn = aws_ram_resource_share.example.arn
}

AWS Organization

resource "aws_ram_principal_association" "example" {
  principal          = aws_organizations_organization.example.arn
  resource_share_arn = aws_ram_resource_share.example.arn
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import RAM Principal Associations using their Resource Share ARN and the principal separated by a comma. For example:

import {
  to = aws_ram_principal_association.example
  id = "arn:aws:ram:eu-west-1:123456789012:resource-share/73da1ab9-b94a-4ba3-8eb4-45917f7f4b12,123456789012"
}

Using terraform import, import RAM Principal Associations using their Resource Share ARN and the principal separated by a comma. For example:

% terraform import aws_ram_principal_association.example arn:aws:ram:eu-west-1:123456789012:resource-share/73da1ab9-b94a-4ba3-8eb4-45917f7f4b12,123456789012