Show / Hide Table of Contents

Class GetRouteTable

Inheritance
System.Object
GetRouteTable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.Ec2
Assembly: Pulumi.Aws.dll
Syntax
public static class GetRouteTable

Methods

View Source

InvokeAsync(GetRouteTableArgs, InvokeOptions)

aws.ec2.RouteTable provides details about a specific Route Table.

This resource can prove useful when a module accepts a Subnet id as an input variable and needs to, for example, add a route in the Route Table.

{{% examples %}}

Example Usage

{{% example %}}

The following example shows how one might accept a Route Table id as a variable and use this data source to obtain the data necessary to create a route.

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var config = new Config();
    var subnetId = config.RequireObject<dynamic>("subnetId");
    var selected = Output.Create(Aws.Ec2.GetRouteTable.InvokeAsync(new Aws.Ec2.GetRouteTableArgs
    {
        SubnetId = subnetId,
    }));
    var route = new Aws.Ec2.Route("route", new Aws.Ec2.RouteArgs
    {
        DestinationCidrBlock = "10.0.1.0/22",
        RouteTableId = selected.Apply(selected => selected.Id),
        VpcPeeringConnectionId = "pcx-45ff3dc1",
    });
}

}

{{% /example %}} {{% /examples %}}

Declaration
public static Task<GetRouteTableResult> InvokeAsync(GetRouteTableArgs args = null, InvokeOptions options = null)
Parameters
Type Name Description
GetRouteTableArgs args
InvokeOptions options
Returns
Type Description
System.Threading.Tasks.Task<GetRouteTableResult>
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.