Resource: aws_ram_resource_share_accepter

Manage accepting a Resource Access Manager (RAM) Resource Share invitation. From a _receiver_ AWS account, accept an invitation to share resources that were shared by a _sender_ AWS account. To create a resource share in the _sender_, see the aws_ram_resource_share resource.

Example Usage

This configuration provides an example of using multiple Terraform AWS providers to configure two different AWS accounts. In the _sender_ account, the configuration creates a aws_ram_resource_share and uses a data source in the _receiver_ account to create a aws_ram_principal_association resource with the _receiver's_ account ID. In the _receiver_ account, the configuration accepts the invitation to share resources with the aws_ram_resource_share_accepter.

provider "aws" {
  profile = "profile2"
}

provider "aws" {
  alias   = "alternate"
  profile = "profile1"
}

resource "aws_ram_resource_share" "sender_share" {
  provider = aws.alternate

  name                      = "tf-test-resource-share"
  allow_external_principals = true

  tags = {
    Name = "tf-test-resource-share"
  }
}

resource "aws_ram_principal_association" "sender_invite" {
  provider = aws.alternate

  principal          = data.aws_caller_identity.receiver.account_id
  resource_share_arn = aws_ram_resource_share.sender_share.arn
}

data "aws_caller_identity" "receiver" {}

resource "aws_ram_resource_share_accepter" "receiver_accept" {
  share_arn = aws_ram_principal_association.sender_invite.resource_share_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 resource share accepters using the resource share ARN. For example:

import {
  to = aws_ram_resource_share_accepter.example
  id = "arn:aws:ram:us-east-1:123456789012:resource-share/c4b56393-e8d9-89d9-6dc9-883752de4767"
}

Using terraform import, import resource share accepters using the resource share ARN. For example:

% terraform import aws_ram_resource_share_accepter.example arn:aws:ram:us-east-1:123456789012:resource-share/c4b56393-e8d9-89d9-6dc9-883752de4767