1. Packages
  2. AWS
  3. API Docs
  4. ram
  5. ResourceAssociation
AWS v6.74.0 published on Wednesday, Mar 26, 2025 by Pulumi

aws.ram.ResourceAssociation

Explore with Pulumi AI

Manages a Resource Access Manager (RAM) Resource Association.

NOTE: Certain AWS resources (e.g., EC2 Subnets) can only be shared in an AWS account that is a member of an AWS Organizations organization with organization-wide Resource Access Manager functionality enabled. See the Resource Access Manager User Guide and AWS service specific documentation for additional information.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.ram.ResourceAssociation("example", {
    resourceArn: exampleAwsSubnet.arn,
    resourceShareArn: exampleAwsRamResourceShare.arn,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ram.ResourceAssociation("example",
    resource_arn=example_aws_subnet["arn"],
    resource_share_arn=example_aws_ram_resource_share["arn"])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ram"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ram.NewResourceAssociation(ctx, "example", &ram.ResourceAssociationArgs{
			ResourceArn:      pulumi.Any(exampleAwsSubnet.Arn),
			ResourceShareArn: pulumi.Any(exampleAwsRamResourceShare.Arn),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Ram.ResourceAssociation("example", new()
    {
        ResourceArn = exampleAwsSubnet.Arn,
        ResourceShareArn = exampleAwsRamResourceShare.Arn,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ram.ResourceAssociation;
import com.pulumi.aws.ram.ResourceAssociationArgs;
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 ResourceAssociation("example", ResourceAssociationArgs.builder()
            .resourceArn(exampleAwsSubnet.arn())
            .resourceShareArn(exampleAwsRamResourceShare.arn())
            .build());

    }
}
Copy
resources:
  example:
    type: aws:ram:ResourceAssociation
    properties:
      resourceArn: ${exampleAwsSubnet.arn}
      resourceShareArn: ${exampleAwsRamResourceShare.arn}
Copy

Create ResourceAssociation Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ResourceAssociation(name: string, args: ResourceAssociationArgs, opts?: CustomResourceOptions);
@overload
def ResourceAssociation(resource_name: str,
                        args: ResourceAssociationArgs,
                        opts: Optional[ResourceOptions] = None)

@overload
def ResourceAssociation(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        resource_arn: Optional[str] = None,
                        resource_share_arn: Optional[str] = None)
func NewResourceAssociation(ctx *Context, name string, args ResourceAssociationArgs, opts ...ResourceOption) (*ResourceAssociation, error)
public ResourceAssociation(string name, ResourceAssociationArgs args, CustomResourceOptions? opts = null)
public ResourceAssociation(String name, ResourceAssociationArgs args)
public ResourceAssociation(String name, ResourceAssociationArgs args, CustomResourceOptions options)
type: aws:ram:ResourceAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ResourceAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ResourceAssociationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ResourceAssociationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ResourceAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ResourceAssociationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var resourceAssociationResource = new Aws.Ram.ResourceAssociation("resourceAssociationResource", new()
{
    ResourceArn = "string",
    ResourceShareArn = "string",
});
Copy
example, err := ram.NewResourceAssociation(ctx, "resourceAssociationResource", &ram.ResourceAssociationArgs{
	ResourceArn:      pulumi.String("string"),
	ResourceShareArn: pulumi.String("string"),
})
Copy
var resourceAssociationResource = new ResourceAssociation("resourceAssociationResource", ResourceAssociationArgs.builder()
    .resourceArn("string")
    .resourceShareArn("string")
    .build());
Copy
resource_association_resource = aws.ram.ResourceAssociation("resourceAssociationResource",
    resource_arn="string",
    resource_share_arn="string")
Copy
const resourceAssociationResource = new aws.ram.ResourceAssociation("resourceAssociationResource", {
    resourceArn: "string",
    resourceShareArn: "string",
});
Copy
type: aws:ram:ResourceAssociation
properties:
    resourceArn: string
    resourceShareArn: string
Copy

ResourceAssociation Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ResourceAssociation resource accepts the following input properties:

ResourceArn
This property is required.
Changes to this property will trigger replacement.
string
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
ResourceShareArn
This property is required.
Changes to this property will trigger replacement.
string
Amazon Resource Name (ARN) of the RAM Resource Share.
ResourceArn
This property is required.
Changes to this property will trigger replacement.
string
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
ResourceShareArn
This property is required.
Changes to this property will trigger replacement.
string
Amazon Resource Name (ARN) of the RAM Resource Share.
resourceArn
This property is required.
Changes to this property will trigger replacement.
String
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
resourceShareArn
This property is required.
Changes to this property will trigger replacement.
String
Amazon Resource Name (ARN) of the RAM Resource Share.
resourceArn
This property is required.
Changes to this property will trigger replacement.
string
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
resourceShareArn
This property is required.
Changes to this property will trigger replacement.
string
Amazon Resource Name (ARN) of the RAM Resource Share.
resource_arn
This property is required.
Changes to this property will trigger replacement.
str
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
resource_share_arn
This property is required.
Changes to this property will trigger replacement.
str
Amazon Resource Name (ARN) of the RAM Resource Share.
resourceArn
This property is required.
Changes to this property will trigger replacement.
String
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
resourceShareArn
This property is required.
Changes to this property will trigger replacement.
String
Amazon Resource Name (ARN) of the RAM Resource Share.

Outputs

All input properties are implicitly available as output properties. Additionally, the ResourceAssociation 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 ResourceAssociation Resource

Get an existing ResourceAssociation 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?: ResourceAssociationState, opts?: CustomResourceOptions): ResourceAssociation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        resource_arn: Optional[str] = None,
        resource_share_arn: Optional[str] = None) -> ResourceAssociation
func GetResourceAssociation(ctx *Context, name string, id IDInput, state *ResourceAssociationState, opts ...ResourceOption) (*ResourceAssociation, error)
public static ResourceAssociation Get(string name, Input<string> id, ResourceAssociationState? state, CustomResourceOptions? opts = null)
public static ResourceAssociation get(String name, Output<String> id, ResourceAssociationState state, CustomResourceOptions options)
resources:  _:    type: aws:ram:ResourceAssociation    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
ResourceArn Changes to this property will trigger replacement. string
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
ResourceShareArn Changes to this property will trigger replacement. string
Amazon Resource Name (ARN) of the RAM Resource Share.
ResourceArn Changes to this property will trigger replacement. string
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
ResourceShareArn Changes to this property will trigger replacement. string
Amazon Resource Name (ARN) of the RAM Resource Share.
resourceArn Changes to this property will trigger replacement. String
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
resourceShareArn Changes to this property will trigger replacement. String
Amazon Resource Name (ARN) of the RAM Resource Share.
resourceArn Changes to this property will trigger replacement. string
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
resourceShareArn Changes to this property will trigger replacement. string
Amazon Resource Name (ARN) of the RAM Resource Share.
resource_arn Changes to this property will trigger replacement. str
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
resource_share_arn Changes to this property will trigger replacement. str
Amazon Resource Name (ARN) of the RAM Resource Share.
resourceArn Changes to this property will trigger replacement. String
Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share.
resourceShareArn Changes to this property will trigger replacement. String
Amazon Resource Name (ARN) of the RAM Resource Share.

Import

Using pulumi import, import RAM Resource Associations using their Resource Share ARN and Resource ARN separated by a comma. For example:

$ pulumi import aws:ram/resourceAssociation:ResourceAssociation example arn:aws:ram:eu-west-1:123456789012:resource-share/73da1ab9-b94a-4ba3-8eb4-45917f7f4b12,arn:aws:ec2:eu-west-1:123456789012:subnet/subnet-12345678
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.