-
Notifications
You must be signed in to change notification settings - Fork 151
/
routeTableAssociation.go
348 lines (288 loc) · 12.7 KB
/
routeTableAssociation.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
// *** 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 (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a resource to create an association between a route table and a subnet or a route table and an
// internet gateway or virtual private gateway.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ec2.NewRouteTableAssociation(ctx, "routeTableAssociation", &ec2.RouteTableAssociationArgs{
// SubnetId: pulumi.Any(aws_subnet.Foo.Id),
// RouteTableId: pulumi.Any(aws_route_table.Bar.Id),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ec2.NewRouteTableAssociation(ctx, "routeTableAssociation", &ec2.RouteTableAssociationArgs{
// GatewayId: pulumi.Any(aws_internet_gateway.Foo.Id),
// RouteTableId: pulumi.Any(aws_route_table.Bar.Id),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// is already associated, will result in an error (e.g., `Resource.AlreadyAssociatedthe specified association for route table rtb-4176657279 conflicts with an existing association`) unless you first import the original association. EC2 Route Table Associations can be imported using the associated resource ID and Route Table ID separated by a forward slash (`/`). For example with EC2 Subnets
//
// ```sh
// $ pulumi import aws:ec2/routeTableAssociation:RouteTableAssociation assoc subnet-6777656e646f6c796e/rtb-656c65616e6f72
// ```
//
// For example with EC2 Internet Gateways
//
// ```sh
// $ pulumi import aws:ec2/routeTableAssociation:RouteTableAssociation assoc igw-01b3a60780f8d034a/rtb-656c65616e6f72
// ```
type RouteTableAssociation struct {
pulumi.CustomResourceState
// The gateway ID to create an association. Conflicts with `subnetId`.
GatewayId pulumi.StringPtrOutput `pulumi:"gatewayId"`
// The ID of the routing table to associate with.
RouteTableId pulumi.StringOutput `pulumi:"routeTableId"`
// The subnet ID to create an association. Conflicts with `gatewayId`.
SubnetId pulumi.StringPtrOutput `pulumi:"subnetId"`
}
// NewRouteTableAssociation registers a new resource with the given unique name, arguments, and options.
func NewRouteTableAssociation(ctx *pulumi.Context,
name string, args *RouteTableAssociationArgs, opts ...pulumi.ResourceOption) (*RouteTableAssociation, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.RouteTableId == nil {
return nil, errors.New("invalid value for required argument 'RouteTableId'")
}
var resource RouteTableAssociation
err := ctx.RegisterResource("aws:ec2/routeTableAssociation:RouteTableAssociation", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetRouteTableAssociation gets an existing RouteTableAssociation resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetRouteTableAssociation(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RouteTableAssociationState, opts ...pulumi.ResourceOption) (*RouteTableAssociation, error) {
var resource RouteTableAssociation
err := ctx.ReadResource("aws:ec2/routeTableAssociation:RouteTableAssociation", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering RouteTableAssociation resources.
type routeTableAssociationState struct {
// The gateway ID to create an association. Conflicts with `subnetId`.
GatewayId *string `pulumi:"gatewayId"`
// The ID of the routing table to associate with.
RouteTableId *string `pulumi:"routeTableId"`
// The subnet ID to create an association. Conflicts with `gatewayId`.
SubnetId *string `pulumi:"subnetId"`
}
type RouteTableAssociationState struct {
// The gateway ID to create an association. Conflicts with `subnetId`.
GatewayId pulumi.StringPtrInput
// The ID of the routing table to associate with.
RouteTableId pulumi.StringPtrInput
// The subnet ID to create an association. Conflicts with `gatewayId`.
SubnetId pulumi.StringPtrInput
}
func (RouteTableAssociationState) ElementType() reflect.Type {
return reflect.TypeOf((*routeTableAssociationState)(nil)).Elem()
}
type routeTableAssociationArgs struct {
// The gateway ID to create an association. Conflicts with `subnetId`.
GatewayId *string `pulumi:"gatewayId"`
// The ID of the routing table to associate with.
RouteTableId string `pulumi:"routeTableId"`
// The subnet ID to create an association. Conflicts with `gatewayId`.
SubnetId *string `pulumi:"subnetId"`
}
// The set of arguments for constructing a RouteTableAssociation resource.
type RouteTableAssociationArgs struct {
// The gateway ID to create an association. Conflicts with `subnetId`.
GatewayId pulumi.StringPtrInput
// The ID of the routing table to associate with.
RouteTableId pulumi.StringInput
// The subnet ID to create an association. Conflicts with `gatewayId`.
SubnetId pulumi.StringPtrInput
}
func (RouteTableAssociationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*routeTableAssociationArgs)(nil)).Elem()
}
type RouteTableAssociationInput interface {
pulumi.Input
ToRouteTableAssociationOutput() RouteTableAssociationOutput
ToRouteTableAssociationOutputWithContext(ctx context.Context) RouteTableAssociationOutput
}
func (*RouteTableAssociation) ElementType() reflect.Type {
return reflect.TypeOf((*RouteTableAssociation)(nil))
}
func (i *RouteTableAssociation) ToRouteTableAssociationOutput() RouteTableAssociationOutput {
return i.ToRouteTableAssociationOutputWithContext(context.Background())
}
func (i *RouteTableAssociation) ToRouteTableAssociationOutputWithContext(ctx context.Context) RouteTableAssociationOutput {
return pulumi.ToOutputWithContext(ctx, i).(RouteTableAssociationOutput)
}
func (i *RouteTableAssociation) ToRouteTableAssociationPtrOutput() RouteTableAssociationPtrOutput {
return i.ToRouteTableAssociationPtrOutputWithContext(context.Background())
}
func (i *RouteTableAssociation) ToRouteTableAssociationPtrOutputWithContext(ctx context.Context) RouteTableAssociationPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(RouteTableAssociationPtrOutput)
}
type RouteTableAssociationPtrInput interface {
pulumi.Input
ToRouteTableAssociationPtrOutput() RouteTableAssociationPtrOutput
ToRouteTableAssociationPtrOutputWithContext(ctx context.Context) RouteTableAssociationPtrOutput
}
type routeTableAssociationPtrType RouteTableAssociationArgs
func (*routeTableAssociationPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**RouteTableAssociation)(nil))
}
func (i *routeTableAssociationPtrType) ToRouteTableAssociationPtrOutput() RouteTableAssociationPtrOutput {
return i.ToRouteTableAssociationPtrOutputWithContext(context.Background())
}
func (i *routeTableAssociationPtrType) ToRouteTableAssociationPtrOutputWithContext(ctx context.Context) RouteTableAssociationPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(RouteTableAssociationPtrOutput)
}
// RouteTableAssociationArrayInput is an input type that accepts RouteTableAssociationArray and RouteTableAssociationArrayOutput values.
// You can construct a concrete instance of `RouteTableAssociationArrayInput` via:
//
// RouteTableAssociationArray{ RouteTableAssociationArgs{...} }
type RouteTableAssociationArrayInput interface {
pulumi.Input
ToRouteTableAssociationArrayOutput() RouteTableAssociationArrayOutput
ToRouteTableAssociationArrayOutputWithContext(context.Context) RouteTableAssociationArrayOutput
}
type RouteTableAssociationArray []RouteTableAssociationInput
func (RouteTableAssociationArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*RouteTableAssociation)(nil))
}
func (i RouteTableAssociationArray) ToRouteTableAssociationArrayOutput() RouteTableAssociationArrayOutput {
return i.ToRouteTableAssociationArrayOutputWithContext(context.Background())
}
func (i RouteTableAssociationArray) ToRouteTableAssociationArrayOutputWithContext(ctx context.Context) RouteTableAssociationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(RouteTableAssociationArrayOutput)
}
// RouteTableAssociationMapInput is an input type that accepts RouteTableAssociationMap and RouteTableAssociationMapOutput values.
// You can construct a concrete instance of `RouteTableAssociationMapInput` via:
//
// RouteTableAssociationMap{ "key": RouteTableAssociationArgs{...} }
type RouteTableAssociationMapInput interface {
pulumi.Input
ToRouteTableAssociationMapOutput() RouteTableAssociationMapOutput
ToRouteTableAssociationMapOutputWithContext(context.Context) RouteTableAssociationMapOutput
}
type RouteTableAssociationMap map[string]RouteTableAssociationInput
func (RouteTableAssociationMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*RouteTableAssociation)(nil))
}
func (i RouteTableAssociationMap) ToRouteTableAssociationMapOutput() RouteTableAssociationMapOutput {
return i.ToRouteTableAssociationMapOutputWithContext(context.Background())
}
func (i RouteTableAssociationMap) ToRouteTableAssociationMapOutputWithContext(ctx context.Context) RouteTableAssociationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(RouteTableAssociationMapOutput)
}
type RouteTableAssociationOutput struct {
*pulumi.OutputState
}
func (RouteTableAssociationOutput) ElementType() reflect.Type {
return reflect.TypeOf((*RouteTableAssociation)(nil))
}
func (o RouteTableAssociationOutput) ToRouteTableAssociationOutput() RouteTableAssociationOutput {
return o
}
func (o RouteTableAssociationOutput) ToRouteTableAssociationOutputWithContext(ctx context.Context) RouteTableAssociationOutput {
return o
}
func (o RouteTableAssociationOutput) ToRouteTableAssociationPtrOutput() RouteTableAssociationPtrOutput {
return o.ToRouteTableAssociationPtrOutputWithContext(context.Background())
}
func (o RouteTableAssociationOutput) ToRouteTableAssociationPtrOutputWithContext(ctx context.Context) RouteTableAssociationPtrOutput {
return o.ApplyT(func(v RouteTableAssociation) *RouteTableAssociation {
return &v
}).(RouteTableAssociationPtrOutput)
}
type RouteTableAssociationPtrOutput struct {
*pulumi.OutputState
}
func (RouteTableAssociationPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**RouteTableAssociation)(nil))
}
func (o RouteTableAssociationPtrOutput) ToRouteTableAssociationPtrOutput() RouteTableAssociationPtrOutput {
return o
}
func (o RouteTableAssociationPtrOutput) ToRouteTableAssociationPtrOutputWithContext(ctx context.Context) RouteTableAssociationPtrOutput {
return o
}
type RouteTableAssociationArrayOutput struct{ *pulumi.OutputState }
func (RouteTableAssociationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]RouteTableAssociation)(nil))
}
func (o RouteTableAssociationArrayOutput) ToRouteTableAssociationArrayOutput() RouteTableAssociationArrayOutput {
return o
}
func (o RouteTableAssociationArrayOutput) ToRouteTableAssociationArrayOutputWithContext(ctx context.Context) RouteTableAssociationArrayOutput {
return o
}
func (o RouteTableAssociationArrayOutput) Index(i pulumi.IntInput) RouteTableAssociationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) RouteTableAssociation {
return vs[0].([]RouteTableAssociation)[vs[1].(int)]
}).(RouteTableAssociationOutput)
}
type RouteTableAssociationMapOutput struct{ *pulumi.OutputState }
func (RouteTableAssociationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]RouteTableAssociation)(nil))
}
func (o RouteTableAssociationMapOutput) ToRouteTableAssociationMapOutput() RouteTableAssociationMapOutput {
return o
}
func (o RouteTableAssociationMapOutput) ToRouteTableAssociationMapOutputWithContext(ctx context.Context) RouteTableAssociationMapOutput {
return o
}
func (o RouteTableAssociationMapOutput) MapIndex(k pulumi.StringInput) RouteTableAssociationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) RouteTableAssociation {
return vs[0].(map[string]RouteTableAssociation)[vs[1].(string)]
}).(RouteTableAssociationOutput)
}
func init() {
pulumi.RegisterOutputType(RouteTableAssociationOutput{})
pulumi.RegisterOutputType(RouteTableAssociationPtrOutput{})
pulumi.RegisterOutputType(RouteTableAssociationArrayOutput{})
pulumi.RegisterOutputType(RouteTableAssociationMapOutput{})
}