AWS RAM Resource Share

This page shows how to write Terraform and CloudFormation for AWS RAM Resource Share and write them securely.

aws_ram_resource_share (Terraform)

The Resource Share in AWS RAM can be configured in Terraform with the resource name aws_ram_resource_share. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

vpc-10-1.tf#L129
resource "aws_ram_resource_share" "rams-prod-1x" {
  name                      = "RAMS-Production-1x"
  allow_external_principals = true

  tags = {
    Environment = "Production"
ram.tf#L2
resource "aws_ram_resource_share" "transit-gateway" {
  name                      = "transit-gateway"
  allow_external_principals = false

  tags = local.tags
}
main.tf#L1
resource "aws_ram_resource_share" "this" {
  name = "transit-share"

  allow_external_principals = true

  tags = {
ram.tf#L1
resource "aws_ram_resource_share" "_" {
    name                      = "transit_gateway"
    allow_external_principals = false
}

data "aws_organizations_organization" "_" {}
main.tf#L13
resource "aws_ram_resource_share" "this" {
  count = var.ram_enabled ? 1 : 0
  name  = var.name
  tags  = merge(var.tags, map("Name", var.name))
}

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Resource Access Manager (RAM) Resource Share. To associate principals with the share, see the aws_ram_principal_association resource. To associate resources with the share, see the aws_ram_resource_association resource.

AWS::RAM::ResourceShare (CloudFormation)

The ResourceShare in RAM can be configured in CloudFormation with the resource name AWS::RAM::ResourceShare. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

1-BIU_transitgwprod.yml#L34
    Type: AWS::RAM::ResourceShare
    DependsOn: TransitGateway
    Properties:
      AllowExternalPrincipals: false
      Name: "Transit Gateway Resource Share"
      ResourceArns:
2-BIU_transitgwprod.yml#L34
    Type: AWS::RAM::ResourceShare
    DependsOn: TransitGateway
    Properties:
      AllowExternalPrincipals: false
      Name: "Transit Gateway Resource Share"
      ResourceArns:
share_resources.yml#L18
    Type: AWS::RAM::ResourceShare
    Properties:
      AllowExternalPrincipals: true
      Name: mesh-share
      Principals:
        - !Ref ConsumerAccountId
share_resources.yml#L18
    Type: AWS::RAM::ResourceShare
    Properties:
      AllowExternalPrincipals: true
      Name: mesh-share
      Principals:
        - !Ref ConsumerAccountId
share_resources.yml#L18
    Type: AWS::RAM::ResourceShare
    Properties:
      AllowExternalPrincipals: true
      Name: mesh-share
      Principals:
        - !Ref ConsumerAccountId
nonprod-resource-share-subnets.json#L46
            "Type": "AWS::RAM::ResourceShare",
            "Properties": {
                "Name": {
                    "Ref": "ResourceShareName"
                },
                "AllowExternalPrincipals": false,
prod-resource-share-subnets.json#L46
            "Type": "AWS::RAM::ResourceShare",
            "Properties": {
                "Name": {
                    "Ref": "ResourceShareName"
                },
                "AllowExternalPrincipals": false,
RAMResourceShareSpecification.json#L22
    "AWS::RAM::ResourceShare": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ram-resourceshare.html",
      "Attributes": {
        "Arn": {
          "PrimitiveType": "String"
        }
RAMResourceShareSpecification.json#L22
    "AWS::RAM::ResourceShare": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ram-resourceshare.html",
      "Attributes": {
        "Arn": {
          "PrimitiveType": "String"
        }
RAMResourceShareSpecification.json#L22
    "AWS::RAM::ResourceShare": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ram-resourceshare.html",
      "Attributes": {
        "Arn": {
          "PrimitiveType": "String"
        }

Parameters

Explanation in CloudFormation Registry

Specifies a resource share.

Frequently asked questions

What is AWS RAM Resource Share?

AWS RAM Resource Share is a resource for RAM of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS RAM Resource Share?

For Terraform, the trilogy-group/CENPRO-24625, ministryofjustice/modernisation-platform and BorisLabs/terraform-aws-transit-gateway source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the deiselira/aws, deiselira/aws and aws/aws-app-mesh-examples source code examples are useful. See the CloudFormation Example section for further details.