/
getRouteTable.go
96 lines (91 loc) · 3.54 KB
/
getRouteTable.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package ec2
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// `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.
//
// ## Example Usage
//
// 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.
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// subnetId := cfg.RequireObject("subnetId")
// opt0 := subnetId
// selected, err := ec2.LookupRouteTable(ctx, &ec2.LookupRouteTableArgs{
// SubnetId: &opt0,
// }, nil)
// if err != nil {
// return err
// }
// _, err = ec2.NewRoute(ctx, "route", &ec2.RouteArgs{
// RouteTableId: pulumi.String(selected.Id),
// DestinationCidrBlock: pulumi.String("10.0.1.0/22"),
// VpcPeeringConnectionId: pulumi.String("pcx-45ff3dc1"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
func LookupRouteTable(ctx *pulumi.Context, args *LookupRouteTableArgs, opts ...pulumi.InvokeOption) (*LookupRouteTableResult, error) {
var rv LookupRouteTableResult
err := ctx.Invoke("aws:ec2/getRouteTable:getRouteTable", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getRouteTable.
type LookupRouteTableArgs struct {
// Configuration block. Detailed below.
Filters []GetRouteTableFilter `pulumi:"filters"`
// ID of an Internet Gateway or Virtual Private Gateway which is connected to the Route Table (not exported if not passed as a parameter).
GatewayId *string `pulumi:"gatewayId"`
// ID of the specific Route Table to retrieve.
RouteTableId *string `pulumi:"routeTableId"`
// ID of a Subnet which is connected to the Route Table (not exported if not passed as a parameter).
SubnetId *string `pulumi:"subnetId"`
// Map of tags, each pair of which must exactly match a pair on the desired Route Table.
Tags map[string]string `pulumi:"tags"`
// ID of the VPC that the desired Route Table belongs to.
VpcId *string `pulumi:"vpcId"`
}
// A collection of values returned by getRouteTable.
type LookupRouteTableResult struct {
// ARN of the route table.
Arn string `pulumi:"arn"`
// List of associations with attributes detailed below.
Associations []GetRouteTableAssociationType `pulumi:"associations"`
Filters []GetRouteTableFilter `pulumi:"filters"`
// Gateway ID. Only set when associated with an Internet Gateway or Virtual Private Gateway.
GatewayId string `pulumi:"gatewayId"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// ID of the AWS account that owns the route table.
OwnerId string `pulumi:"ownerId"`
// Route Table ID.
RouteTableId string `pulumi:"routeTableId"`
// List of routes with attributes detailed below.
Routes []GetRouteTableRoute `pulumi:"routes"`
// Subnet ID. Only set when associated with a subnet.
SubnetId string `pulumi:"subnetId"`
Tags map[string]string `pulumi:"tags"`
VpcId string `pulumi:"vpcId"`
}