Try AWS Native preview for resources not in the classic version.
aws.ec2transitgateway.Route
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Manages an EC2 Transit Gateway Route.
Example Usage
Standard usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2transitgateway.Route("example", {
destinationCidrBlock: "0.0.0.0/0",
transitGatewayAttachmentId: exampleAwsEc2TransitGatewayVpcAttachment.id,
transitGatewayRouteTableId: exampleAwsEc2TransitGateway.associationDefaultRouteTableId,
});
import pulumi
import pulumi_aws as aws
example = aws.ec2transitgateway.Route("example",
destination_cidr_block="0.0.0.0/0",
transit_gateway_attachment_id=example_aws_ec2_transit_gateway_vpc_attachment["id"],
transit_gateway_route_table_id=example_aws_ec2_transit_gateway["associationDefaultRouteTableId"])
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.NewRoute(ctx, "example", &ec2transitgateway.RouteArgs{
DestinationCidrBlock: pulumi.String("0.0.0.0/0"),
TransitGatewayAttachmentId: pulumi.Any(exampleAwsEc2TransitGatewayVpcAttachment.Id),
TransitGatewayRouteTableId: pulumi.Any(exampleAwsEc2TransitGateway.AssociationDefaultRouteTableId),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2TransitGateway.Route("example", new()
{
DestinationCidrBlock = "0.0.0.0/0",
TransitGatewayAttachmentId = exampleAwsEc2TransitGatewayVpcAttachment.Id,
TransitGatewayRouteTableId = exampleAwsEc2TransitGateway.AssociationDefaultRouteTableId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.Route;
import com.pulumi.aws.ec2transitgateway.RouteArgs;
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 Route("example", RouteArgs.builder()
.destinationCidrBlock("0.0.0.0/0")
.transitGatewayAttachmentId(exampleAwsEc2TransitGatewayVpcAttachment.id())
.transitGatewayRouteTableId(exampleAwsEc2TransitGateway.associationDefaultRouteTableId())
.build());
}
}
resources:
example:
type: aws:ec2transitgateway:Route
properties:
destinationCidrBlock: 0.0.0.0/0
transitGatewayAttachmentId: ${exampleAwsEc2TransitGatewayVpcAttachment.id}
transitGatewayRouteTableId: ${exampleAwsEc2TransitGateway.associationDefaultRouteTableId}
Blackhole route
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2transitgateway.Route("example", {
destinationCidrBlock: "0.0.0.0/0",
blackhole: true,
transitGatewayRouteTableId: exampleAwsEc2TransitGateway.associationDefaultRouteTableId,
});
import pulumi
import pulumi_aws as aws
example = aws.ec2transitgateway.Route("example",
destination_cidr_block="0.0.0.0/0",
blackhole=True,
transit_gateway_route_table_id=example_aws_ec2_transit_gateway["associationDefaultRouteTableId"])
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.NewRoute(ctx, "example", &ec2transitgateway.RouteArgs{
DestinationCidrBlock: pulumi.String("0.0.0.0/0"),
Blackhole: pulumi.Bool(true),
TransitGatewayRouteTableId: pulumi.Any(exampleAwsEc2TransitGateway.AssociationDefaultRouteTableId),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2TransitGateway.Route("example", new()
{
DestinationCidrBlock = "0.0.0.0/0",
Blackhole = true,
TransitGatewayRouteTableId = exampleAwsEc2TransitGateway.AssociationDefaultRouteTableId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.Route;
import com.pulumi.aws.ec2transitgateway.RouteArgs;
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 Route("example", RouteArgs.builder()
.destinationCidrBlock("0.0.0.0/0")
.blackhole(true)
.transitGatewayRouteTableId(exampleAwsEc2TransitGateway.associationDefaultRouteTableId())
.build());
}
}
resources:
example:
type: aws:ec2transitgateway:Route
properties:
destinationCidrBlock: 0.0.0.0/0
blackhole: true
transitGatewayRouteTableId: ${exampleAwsEc2TransitGateway.associationDefaultRouteTableId}
Create Route Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Route(name: string, args: RouteArgs, opts?: CustomResourceOptions);
@overload
def Route(resource_name: str,
args: RouteArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Route(resource_name: str,
opts: Optional[ResourceOptions] = None,
destination_cidr_block: Optional[str] = None,
transit_gateway_route_table_id: Optional[str] = None,
blackhole: Optional[bool] = None,
transit_gateway_attachment_id: Optional[str] = None)
func NewRoute(ctx *Context, name string, args RouteArgs, opts ...ResourceOption) (*Route, error)
public Route(string name, RouteArgs args, CustomResourceOptions? opts = null)
type: aws:ec2transitgateway:Route
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RouteArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RouteArgs
- 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 examplerouteResourceResourceFromEc2transitgatewayroute = new Aws.Ec2TransitGateway.Route("examplerouteResourceResourceFromEc2transitgatewayroute", new()
{
DestinationCidrBlock = "string",
TransitGatewayRouteTableId = "string",
Blackhole = false,
TransitGatewayAttachmentId = "string",
});
example, err := ec2transitgateway.NewRoute(ctx, "examplerouteResourceResourceFromEc2transitgatewayroute", &ec2transitgateway.RouteArgs{
DestinationCidrBlock: pulumi.String("string"),
TransitGatewayRouteTableId: pulumi.String("string"),
Blackhole: pulumi.Bool(false),
TransitGatewayAttachmentId: pulumi.String("string"),
})
var examplerouteResourceResourceFromEc2transitgatewayroute = new Route("examplerouteResourceResourceFromEc2transitgatewayroute", RouteArgs.builder()
.destinationCidrBlock("string")
.transitGatewayRouteTableId("string")
.blackhole(false)
.transitGatewayAttachmentId("string")
.build());
exampleroute_resource_resource_from_ec2transitgatewayroute = aws.ec2transitgateway.Route("examplerouteResourceResourceFromEc2transitgatewayroute",
destination_cidr_block="string",
transit_gateway_route_table_id="string",
blackhole=False,
transit_gateway_attachment_id="string")
const examplerouteResourceResourceFromEc2transitgatewayroute = new aws.ec2transitgateway.Route("examplerouteResourceResourceFromEc2transitgatewayroute", {
destinationCidrBlock: "string",
transitGatewayRouteTableId: "string",
blackhole: false,
transitGatewayAttachmentId: "string",
});
type: aws:ec2transitgateway:Route
properties:
blackhole: false
destinationCidrBlock: string
transitGatewayAttachmentId: string
transitGatewayRouteTableId: string
Route Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Route resource accepts the following input properties:
- Destination
Cidr stringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- Transit
Gateway stringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
- Blackhole bool
- Indicates whether to drop traffic that matches this route (default to
false
). - Transit
Gateway stringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false).
- Destination
Cidr stringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- Transit
Gateway stringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
- Blackhole bool
- Indicates whether to drop traffic that matches this route (default to
false
). - Transit
Gateway stringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false).
- destination
Cidr StringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- transit
Gateway StringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
- blackhole Boolean
- Indicates whether to drop traffic that matches this route (default to
false
). - transit
Gateway StringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false).
- destination
Cidr stringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- transit
Gateway stringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
- blackhole boolean
- Indicates whether to drop traffic that matches this route (default to
false
). - transit
Gateway stringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false).
- destination_
cidr_ strblock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- transit_
gateway_ strroute_ table_ id - Identifier of EC2 Transit Gateway Route Table.
- blackhole bool
- Indicates whether to drop traffic that matches this route (default to
false
). - transit_
gateway_ strattachment_ id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false).
- destination
Cidr StringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- transit
Gateway StringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
- blackhole Boolean
- Indicates whether to drop traffic that matches this route (default to
false
). - transit
Gateway StringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false).
Outputs
All input properties are implicitly available as output properties. Additionally, the Route 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 Route Resource
Get an existing Route 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?: RouteState, opts?: CustomResourceOptions): Route
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
blackhole: Optional[bool] = None,
destination_cidr_block: Optional[str] = None,
transit_gateway_attachment_id: Optional[str] = None,
transit_gateway_route_table_id: Optional[str] = None) -> Route
func GetRoute(ctx *Context, name string, id IDInput, state *RouteState, opts ...ResourceOption) (*Route, error)
public static Route Get(string name, Input<string> id, RouteState? state, CustomResourceOptions? opts = null)
public static Route get(String name, Output<String> id, RouteState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Blackhole bool
- Indicates whether to drop traffic that matches this route (default to
false
). - Destination
Cidr stringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- Transit
Gateway stringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false). - Transit
Gateway stringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
- Blackhole bool
- Indicates whether to drop traffic that matches this route (default to
false
). - Destination
Cidr stringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- Transit
Gateway stringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false). - Transit
Gateway stringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
- blackhole Boolean
- Indicates whether to drop traffic that matches this route (default to
false
). - destination
Cidr StringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- transit
Gateway StringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false). - transit
Gateway StringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
- blackhole boolean
- Indicates whether to drop traffic that matches this route (default to
false
). - destination
Cidr stringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- transit
Gateway stringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false). - transit
Gateway stringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
- blackhole bool
- Indicates whether to drop traffic that matches this route (default to
false
). - destination_
cidr_ strblock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- transit_
gateway_ strattachment_ id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false). - transit_
gateway_ strroute_ table_ id - Identifier of EC2 Transit Gateway Route Table.
- blackhole Boolean
- Indicates whether to drop traffic that matches this route (default to
false
). - destination
Cidr StringBlock - IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
- transit
Gateway StringAttachment Id - Identifier of EC2 Transit Gateway Attachment (required if
blackhole
is set to false). - transit
Gateway StringRoute Table Id - Identifier of EC2 Transit Gateway Route Table.
Import
Using pulumi import
, import aws_ec2_transit_gateway_route
using the EC2 Transit Gateway Route Table, an underscore, and the destination. For example:
$ pulumi import aws:ec2transitgateway/route:Route example tgw-rtb-12345678_0.0.0.0/0
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.
Try AWS Native preview for resources not in the classic version.