1. Packages
  2. AWS
  3. API Docs
  4. ec2transitgateway
  5. PolicyTableAssociation
AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi

aws.ec2transitgateway.PolicyTableAssociation

Explore with Pulumi AI

Manages an EC2 Transit Gateway Policy Table association.

Example Usage

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

const example = new aws.ec2transitgateway.PolicyTableAssociation("example", {
    transitGatewayAttachmentId: exampleAwsNetworkmanagerTransitGatewayPeering.transitGatewayPeeringAttachmentId,
    transitGatewayPolicyTableId: exampleAwsEc2TransitGatewayPolicyTable.id,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ec2transitgateway.PolicyTableAssociation("example",
    transit_gateway_attachment_id=example_aws_networkmanager_transit_gateway_peering["transitGatewayPeeringAttachmentId"],
    transit_gateway_policy_table_id=example_aws_ec2_transit_gateway_policy_table["id"])
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2transitgateway.NewPolicyTableAssociation(ctx, "example", &ec2transitgateway.PolicyTableAssociationArgs{
			TransitGatewayAttachmentId:  pulumi.Any(exampleAwsNetworkmanagerTransitGatewayPeering.TransitGatewayPeeringAttachmentId),
			TransitGatewayPolicyTableId: pulumi.Any(exampleAwsEc2TransitGatewayPolicyTable.Id),
		})
		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.Ec2TransitGateway.PolicyTableAssociation("example", new()
    {
        TransitGatewayAttachmentId = exampleAwsNetworkmanagerTransitGatewayPeering.TransitGatewayPeeringAttachmentId,
        TransitGatewayPolicyTableId = exampleAwsEc2TransitGatewayPolicyTable.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.PolicyTableAssociation;
import com.pulumi.aws.ec2transitgateway.PolicyTableAssociationArgs;
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 PolicyTableAssociation("example", PolicyTableAssociationArgs.builder()
            .transitGatewayAttachmentId(exampleAwsNetworkmanagerTransitGatewayPeering.transitGatewayPeeringAttachmentId())
            .transitGatewayPolicyTableId(exampleAwsEc2TransitGatewayPolicyTable.id())
            .build());

    }
}
Copy
resources:
  example:
    type: aws:ec2transitgateway:PolicyTableAssociation
    properties:
      transitGatewayAttachmentId: ${exampleAwsNetworkmanagerTransitGatewayPeering.transitGatewayPeeringAttachmentId}
      transitGatewayPolicyTableId: ${exampleAwsEc2TransitGatewayPolicyTable.id}
Copy

Create PolicyTableAssociation Resource

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

Constructor syntax

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

@overload
def PolicyTableAssociation(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           transit_gateway_attachment_id: Optional[str] = None,
                           transit_gateway_policy_table_id: Optional[str] = None)
func NewPolicyTableAssociation(ctx *Context, name string, args PolicyTableAssociationArgs, opts ...ResourceOption) (*PolicyTableAssociation, error)
public PolicyTableAssociation(string name, PolicyTableAssociationArgs args, CustomResourceOptions? opts = null)
public PolicyTableAssociation(String name, PolicyTableAssociationArgs args)
public PolicyTableAssociation(String name, PolicyTableAssociationArgs args, CustomResourceOptions options)
type: aws:ec2transitgateway:PolicyTableAssociation
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. PolicyTableAssociationArgs
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. PolicyTableAssociationArgs
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. PolicyTableAssociationArgs
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. PolicyTableAssociationArgs
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. PolicyTableAssociationArgs
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 policyTableAssociationResource = new Aws.Ec2TransitGateway.PolicyTableAssociation("policyTableAssociationResource", new()
{
    TransitGatewayAttachmentId = "string",
    TransitGatewayPolicyTableId = "string",
});
Copy
example, err := ec2transitgateway.NewPolicyTableAssociation(ctx, "policyTableAssociationResource", &ec2transitgateway.PolicyTableAssociationArgs{
	TransitGatewayAttachmentId:  pulumi.String("string"),
	TransitGatewayPolicyTableId: pulumi.String("string"),
})
Copy
var policyTableAssociationResource = new PolicyTableAssociation("policyTableAssociationResource", PolicyTableAssociationArgs.builder()
    .transitGatewayAttachmentId("string")
    .transitGatewayPolicyTableId("string")
    .build());
Copy
policy_table_association_resource = aws.ec2transitgateway.PolicyTableAssociation("policyTableAssociationResource",
    transit_gateway_attachment_id="string",
    transit_gateway_policy_table_id="string")
Copy
const policyTableAssociationResource = new aws.ec2transitgateway.PolicyTableAssociation("policyTableAssociationResource", {
    transitGatewayAttachmentId: "string",
    transitGatewayPolicyTableId: "string",
});
Copy
type: aws:ec2transitgateway:PolicyTableAssociation
properties:
    transitGatewayAttachmentId: string
    transitGatewayPolicyTableId: string
Copy

PolicyTableAssociation 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 PolicyTableAssociation resource accepts the following input properties:

TransitGatewayAttachmentId
This property is required.
Changes to this property will trigger replacement.
string
Identifier of EC2 Transit Gateway Attachment.
TransitGatewayPolicyTableId
This property is required.
Changes to this property will trigger replacement.
string
Identifier of EC2 Transit Gateway Policy Table.
TransitGatewayAttachmentId
This property is required.
Changes to this property will trigger replacement.
string
Identifier of EC2 Transit Gateway Attachment.
TransitGatewayPolicyTableId
This property is required.
Changes to this property will trigger replacement.
string
Identifier of EC2 Transit Gateway Policy Table.
transitGatewayAttachmentId
This property is required.
Changes to this property will trigger replacement.
String
Identifier of EC2 Transit Gateway Attachment.
transitGatewayPolicyTableId
This property is required.
Changes to this property will trigger replacement.
String
Identifier of EC2 Transit Gateway Policy Table.
transitGatewayAttachmentId
This property is required.
Changes to this property will trigger replacement.
string
Identifier of EC2 Transit Gateway Attachment.
transitGatewayPolicyTableId
This property is required.
Changes to this property will trigger replacement.
string
Identifier of EC2 Transit Gateway Policy Table.
transit_gateway_attachment_id
This property is required.
Changes to this property will trigger replacement.
str
Identifier of EC2 Transit Gateway Attachment.
transit_gateway_policy_table_id
This property is required.
Changes to this property will trigger replacement.
str
Identifier of EC2 Transit Gateway Policy Table.
transitGatewayAttachmentId
This property is required.
Changes to this property will trigger replacement.
String
Identifier of EC2 Transit Gateway Attachment.
transitGatewayPolicyTableId
This property is required.
Changes to this property will trigger replacement.
String
Identifier of EC2 Transit Gateway Policy Table.

Outputs

All input properties are implicitly available as output properties. Additionally, the PolicyTableAssociation resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
ResourceId string
Identifier of the resource
ResourceType string
Type of the resource
Id string
The provider-assigned unique ID for this managed resource.
ResourceId string
Identifier of the resource
ResourceType string
Type of the resource
id String
The provider-assigned unique ID for this managed resource.
resourceId String
Identifier of the resource
resourceType String
Type of the resource
id string
The provider-assigned unique ID for this managed resource.
resourceId string
Identifier of the resource
resourceType string
Type of the resource
id str
The provider-assigned unique ID for this managed resource.
resource_id str
Identifier of the resource
resource_type str
Type of the resource
id String
The provider-assigned unique ID for this managed resource.
resourceId String
Identifier of the resource
resourceType String
Type of the resource

Look up Existing PolicyTableAssociation Resource

Get an existing PolicyTableAssociation 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?: PolicyTableAssociationState, opts?: CustomResourceOptions): PolicyTableAssociation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        resource_id: Optional[str] = None,
        resource_type: Optional[str] = None,
        transit_gateway_attachment_id: Optional[str] = None,
        transit_gateway_policy_table_id: Optional[str] = None) -> PolicyTableAssociation
func GetPolicyTableAssociation(ctx *Context, name string, id IDInput, state *PolicyTableAssociationState, opts ...ResourceOption) (*PolicyTableAssociation, error)
public static PolicyTableAssociation Get(string name, Input<string> id, PolicyTableAssociationState? state, CustomResourceOptions? opts = null)
public static PolicyTableAssociation get(String name, Output<String> id, PolicyTableAssociationState state, CustomResourceOptions options)
resources:  _:    type: aws:ec2transitgateway:PolicyTableAssociation    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:
ResourceId string
Identifier of the resource
ResourceType string
Type of the resource
TransitGatewayAttachmentId Changes to this property will trigger replacement. string
Identifier of EC2 Transit Gateway Attachment.
TransitGatewayPolicyTableId Changes to this property will trigger replacement. string
Identifier of EC2 Transit Gateway Policy Table.
ResourceId string
Identifier of the resource
ResourceType string
Type of the resource
TransitGatewayAttachmentId Changes to this property will trigger replacement. string
Identifier of EC2 Transit Gateway Attachment.
TransitGatewayPolicyTableId Changes to this property will trigger replacement. string
Identifier of EC2 Transit Gateway Policy Table.
resourceId String
Identifier of the resource
resourceType String
Type of the resource
transitGatewayAttachmentId Changes to this property will trigger replacement. String
Identifier of EC2 Transit Gateway Attachment.
transitGatewayPolicyTableId Changes to this property will trigger replacement. String
Identifier of EC2 Transit Gateway Policy Table.
resourceId string
Identifier of the resource
resourceType string
Type of the resource
transitGatewayAttachmentId Changes to this property will trigger replacement. string
Identifier of EC2 Transit Gateway Attachment.
transitGatewayPolicyTableId Changes to this property will trigger replacement. string
Identifier of EC2 Transit Gateway Policy Table.
resource_id str
Identifier of the resource
resource_type str
Type of the resource
transit_gateway_attachment_id Changes to this property will trigger replacement. str
Identifier of EC2 Transit Gateway Attachment.
transit_gateway_policy_table_id Changes to this property will trigger replacement. str
Identifier of EC2 Transit Gateway Policy Table.
resourceId String
Identifier of the resource
resourceType String
Type of the resource
transitGatewayAttachmentId Changes to this property will trigger replacement. String
Identifier of EC2 Transit Gateway Attachment.
transitGatewayPolicyTableId Changes to this property will trigger replacement. String
Identifier of EC2 Transit Gateway Policy Table.

Import

Using pulumi import, import aws_ec2_transit_gateway_policy_table_association using the EC2 Transit Gateway Policy Table identifier, an underscore, and the EC2 Transit Gateway Attachment identifier. For example:

$ pulumi import aws:ec2transitgateway/policyTableAssociation:PolicyTableAssociation example tgw-rtb-12345678_tgw-attach-87654321
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.