Show / Hide Table of Contents

Class GetRouteTables

Inheritance
System.Object
GetRouteTables
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 GetRouteTables

Methods

View Source

InvokeAsync(GetRouteTablesArgs, InvokeOptions)

This resource can be useful for getting back a list of route table ids to be referenced elsewhere.

{{% examples %}}

Example Usage

{{% example %}}

The following adds a route for a particular cidr block to every (private kops) route table in a specified vpc to use a particular vpc peering connection.

using System.Collections.Generic;
using System.Threading.Tasks;
using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var dict = Output.Create(Initialize());
}

private async Task<IDictionary<string, Output<string>>> Initialize()
{
    var rts = await Aws.Ec2.GetRouteTables.InvokeAsync(new Aws.Ec2.GetRouteTablesArgs
    {
        Filters = 
        {
            new Aws.Ec2.Inputs.GetRouteTablesFilterArgs
            {
                Name = "tag:kubernetes.io/kops/role",
                Values = 
                {
                    "private*",
                },
            },
        },
        VpcId = @var.Vpc_id,
    });
    var route = new List<Aws.Ec2.Route>();
    for (var rangeIndex = 0; rangeIndex < rts.Ids.Length; rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        route.Add(new Aws.Ec2.Route($"route-{range.Value}", new Aws.Ec2.RouteArgs
        {
            DestinationCidrBlock = "10.0.1.0/22",
            RouteTableId = rts.Ids[range.Value],
            VpcPeeringConnectionId = "pcx-0e9a7a9ecd137dc54",
        }));
    }

    return new Dictionary<string, Output<string>>
    {
    };
}

}

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

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