/
defaultSubnet.go
396 lines (335 loc) · 14 KB
/
defaultSubnet.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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
// *** 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 manage a [default AWS VPC subnet](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html#default-vpc-basics) in the current region.
//
// The `ec2.DefaultSubnet` behaves differently from normal resources, in that this provider does not _create_ this resource but instead "adopts" it into management.
//
// The `ec2.DefaultSubnet` resource allows you to manage a region's default VPC subnet but this provider cannot destroy it. Removing this resource from your configuration will remove it from your statefile and the provider management.
//
// ## 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.NewDefaultSubnet(ctx, "defaultAz1", &ec2.DefaultSubnetArgs{
// AvailabilityZone: pulumi.String("us-west-2a"),
// Tags: pulumi.StringMap{
// "Name": pulumi.String("Default subnet for us-west-2a"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Subnets can be imported using the `subnet id`, e.g.
//
// ```sh
// $ pulumi import aws:ec2/defaultSubnet:DefaultSubnet public_subnet subnet-9d4a7b6c
// ```
type DefaultSubnet struct {
pulumi.CustomResourceState
// ARN for the subnet.
Arn pulumi.StringOutput `pulumi:"arn"`
// Whether IPv6 addresses are assigned on creation.
// * `availabilityZoneId`- AZ ID of the subnet.
AssignIpv6AddressOnCreation pulumi.BoolOutput `pulumi:"assignIpv6AddressOnCreation"`
// AZ for the subnet.
AvailabilityZone pulumi.StringOutput `pulumi:"availabilityZone"`
AvailabilityZoneId pulumi.StringOutput `pulumi:"availabilityZoneId"`
// CIDR block for the subnet.
CidrBlock pulumi.StringOutput `pulumi:"cidrBlock"`
CustomerOwnedIpv4Pool pulumi.StringPtrOutput `pulumi:"customerOwnedIpv4Pool"`
// IPv6 CIDR block.
Ipv6CidrBlock pulumi.StringOutput `pulumi:"ipv6CidrBlock"`
Ipv6CidrBlockAssociationId pulumi.StringOutput `pulumi:"ipv6CidrBlockAssociationId"`
MapCustomerOwnedIpOnLaunch pulumi.BoolPtrOutput `pulumi:"mapCustomerOwnedIpOnLaunch"`
// Whether instances launched into the subnet should be assigned a public IP address.
MapPublicIpOnLaunch pulumi.BoolOutput `pulumi:"mapPublicIpOnLaunch"`
OutpostArn pulumi.StringPtrOutput `pulumi:"outpostArn"`
// ID of the AWS account that owns the subnet.
OwnerId pulumi.StringOutput `pulumi:"ownerId"`
// Map of tags to assign to the resource.
Tags pulumi.StringMapOutput `pulumi:"tags"`
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
// VPC ID.
VpcId pulumi.StringOutput `pulumi:"vpcId"`
}
// NewDefaultSubnet registers a new resource with the given unique name, arguments, and options.
func NewDefaultSubnet(ctx *pulumi.Context,
name string, args *DefaultSubnetArgs, opts ...pulumi.ResourceOption) (*DefaultSubnet, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AvailabilityZone == nil {
return nil, errors.New("invalid value for required argument 'AvailabilityZone'")
}
var resource DefaultSubnet
err := ctx.RegisterResource("aws:ec2/defaultSubnet:DefaultSubnet", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetDefaultSubnet gets an existing DefaultSubnet 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 GetDefaultSubnet(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *DefaultSubnetState, opts ...pulumi.ResourceOption) (*DefaultSubnet, error) {
var resource DefaultSubnet
err := ctx.ReadResource("aws:ec2/defaultSubnet:DefaultSubnet", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering DefaultSubnet resources.
type defaultSubnetState struct {
// ARN for the subnet.
Arn *string `pulumi:"arn"`
// Whether IPv6 addresses are assigned on creation.
// * `availabilityZoneId`- AZ ID of the subnet.
AssignIpv6AddressOnCreation *bool `pulumi:"assignIpv6AddressOnCreation"`
// AZ for the subnet.
AvailabilityZone *string `pulumi:"availabilityZone"`
AvailabilityZoneId *string `pulumi:"availabilityZoneId"`
// CIDR block for the subnet.
CidrBlock *string `pulumi:"cidrBlock"`
CustomerOwnedIpv4Pool *string `pulumi:"customerOwnedIpv4Pool"`
// IPv6 CIDR block.
Ipv6CidrBlock *string `pulumi:"ipv6CidrBlock"`
Ipv6CidrBlockAssociationId *string `pulumi:"ipv6CidrBlockAssociationId"`
MapCustomerOwnedIpOnLaunch *bool `pulumi:"mapCustomerOwnedIpOnLaunch"`
// Whether instances launched into the subnet should be assigned a public IP address.
MapPublicIpOnLaunch *bool `pulumi:"mapPublicIpOnLaunch"`
OutpostArn *string `pulumi:"outpostArn"`
// ID of the AWS account that owns the subnet.
OwnerId *string `pulumi:"ownerId"`
// Map of tags to assign to the resource.
Tags map[string]string `pulumi:"tags"`
TagsAll map[string]string `pulumi:"tagsAll"`
// VPC ID.
VpcId *string `pulumi:"vpcId"`
}
type DefaultSubnetState struct {
// ARN for the subnet.
Arn pulumi.StringPtrInput
// Whether IPv6 addresses are assigned on creation.
// * `availabilityZoneId`- AZ ID of the subnet.
AssignIpv6AddressOnCreation pulumi.BoolPtrInput
// AZ for the subnet.
AvailabilityZone pulumi.StringPtrInput
AvailabilityZoneId pulumi.StringPtrInput
// CIDR block for the subnet.
CidrBlock pulumi.StringPtrInput
CustomerOwnedIpv4Pool pulumi.StringPtrInput
// IPv6 CIDR block.
Ipv6CidrBlock pulumi.StringPtrInput
Ipv6CidrBlockAssociationId pulumi.StringPtrInput
MapCustomerOwnedIpOnLaunch pulumi.BoolPtrInput
// Whether instances launched into the subnet should be assigned a public IP address.
MapPublicIpOnLaunch pulumi.BoolPtrInput
OutpostArn pulumi.StringPtrInput
// ID of the AWS account that owns the subnet.
OwnerId pulumi.StringPtrInput
// Map of tags to assign to the resource.
Tags pulumi.StringMapInput
TagsAll pulumi.StringMapInput
// VPC ID.
VpcId pulumi.StringPtrInput
}
func (DefaultSubnetState) ElementType() reflect.Type {
return reflect.TypeOf((*defaultSubnetState)(nil)).Elem()
}
type defaultSubnetArgs struct {
// AZ for the subnet.
AvailabilityZone string `pulumi:"availabilityZone"`
CustomerOwnedIpv4Pool *string `pulumi:"customerOwnedIpv4Pool"`
MapCustomerOwnedIpOnLaunch *bool `pulumi:"mapCustomerOwnedIpOnLaunch"`
// Whether instances launched into the subnet should be assigned a public IP address.
MapPublicIpOnLaunch *bool `pulumi:"mapPublicIpOnLaunch"`
OutpostArn *string `pulumi:"outpostArn"`
// Map of tags to assign to the resource.
Tags map[string]string `pulumi:"tags"`
TagsAll map[string]string `pulumi:"tagsAll"`
}
// The set of arguments for constructing a DefaultSubnet resource.
type DefaultSubnetArgs struct {
// AZ for the subnet.
AvailabilityZone pulumi.StringInput
CustomerOwnedIpv4Pool pulumi.StringPtrInput
MapCustomerOwnedIpOnLaunch pulumi.BoolPtrInput
// Whether instances launched into the subnet should be assigned a public IP address.
MapPublicIpOnLaunch pulumi.BoolPtrInput
OutpostArn pulumi.StringPtrInput
// Map of tags to assign to the resource.
Tags pulumi.StringMapInput
TagsAll pulumi.StringMapInput
}
func (DefaultSubnetArgs) ElementType() reflect.Type {
return reflect.TypeOf((*defaultSubnetArgs)(nil)).Elem()
}
type DefaultSubnetInput interface {
pulumi.Input
ToDefaultSubnetOutput() DefaultSubnetOutput
ToDefaultSubnetOutputWithContext(ctx context.Context) DefaultSubnetOutput
}
func (*DefaultSubnet) ElementType() reflect.Type {
return reflect.TypeOf((*DefaultSubnet)(nil))
}
func (i *DefaultSubnet) ToDefaultSubnetOutput() DefaultSubnetOutput {
return i.ToDefaultSubnetOutputWithContext(context.Background())
}
func (i *DefaultSubnet) ToDefaultSubnetOutputWithContext(ctx context.Context) DefaultSubnetOutput {
return pulumi.ToOutputWithContext(ctx, i).(DefaultSubnetOutput)
}
func (i *DefaultSubnet) ToDefaultSubnetPtrOutput() DefaultSubnetPtrOutput {
return i.ToDefaultSubnetPtrOutputWithContext(context.Background())
}
func (i *DefaultSubnet) ToDefaultSubnetPtrOutputWithContext(ctx context.Context) DefaultSubnetPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(DefaultSubnetPtrOutput)
}
type DefaultSubnetPtrInput interface {
pulumi.Input
ToDefaultSubnetPtrOutput() DefaultSubnetPtrOutput
ToDefaultSubnetPtrOutputWithContext(ctx context.Context) DefaultSubnetPtrOutput
}
type defaultSubnetPtrType DefaultSubnetArgs
func (*defaultSubnetPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**DefaultSubnet)(nil))
}
func (i *defaultSubnetPtrType) ToDefaultSubnetPtrOutput() DefaultSubnetPtrOutput {
return i.ToDefaultSubnetPtrOutputWithContext(context.Background())
}
func (i *defaultSubnetPtrType) ToDefaultSubnetPtrOutputWithContext(ctx context.Context) DefaultSubnetPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(DefaultSubnetPtrOutput)
}
// DefaultSubnetArrayInput is an input type that accepts DefaultSubnetArray and DefaultSubnetArrayOutput values.
// You can construct a concrete instance of `DefaultSubnetArrayInput` via:
//
// DefaultSubnetArray{ DefaultSubnetArgs{...} }
type DefaultSubnetArrayInput interface {
pulumi.Input
ToDefaultSubnetArrayOutput() DefaultSubnetArrayOutput
ToDefaultSubnetArrayOutputWithContext(context.Context) DefaultSubnetArrayOutput
}
type DefaultSubnetArray []DefaultSubnetInput
func (DefaultSubnetArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*DefaultSubnet)(nil)).Elem()
}
func (i DefaultSubnetArray) ToDefaultSubnetArrayOutput() DefaultSubnetArrayOutput {
return i.ToDefaultSubnetArrayOutputWithContext(context.Background())
}
func (i DefaultSubnetArray) ToDefaultSubnetArrayOutputWithContext(ctx context.Context) DefaultSubnetArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(DefaultSubnetArrayOutput)
}
// DefaultSubnetMapInput is an input type that accepts DefaultSubnetMap and DefaultSubnetMapOutput values.
// You can construct a concrete instance of `DefaultSubnetMapInput` via:
//
// DefaultSubnetMap{ "key": DefaultSubnetArgs{...} }
type DefaultSubnetMapInput interface {
pulumi.Input
ToDefaultSubnetMapOutput() DefaultSubnetMapOutput
ToDefaultSubnetMapOutputWithContext(context.Context) DefaultSubnetMapOutput
}
type DefaultSubnetMap map[string]DefaultSubnetInput
func (DefaultSubnetMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*DefaultSubnet)(nil)).Elem()
}
func (i DefaultSubnetMap) ToDefaultSubnetMapOutput() DefaultSubnetMapOutput {
return i.ToDefaultSubnetMapOutputWithContext(context.Background())
}
func (i DefaultSubnetMap) ToDefaultSubnetMapOutputWithContext(ctx context.Context) DefaultSubnetMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(DefaultSubnetMapOutput)
}
type DefaultSubnetOutput struct{ *pulumi.OutputState }
func (DefaultSubnetOutput) ElementType() reflect.Type {
return reflect.TypeOf((*DefaultSubnet)(nil))
}
func (o DefaultSubnetOutput) ToDefaultSubnetOutput() DefaultSubnetOutput {
return o
}
func (o DefaultSubnetOutput) ToDefaultSubnetOutputWithContext(ctx context.Context) DefaultSubnetOutput {
return o
}
func (o DefaultSubnetOutput) ToDefaultSubnetPtrOutput() DefaultSubnetPtrOutput {
return o.ToDefaultSubnetPtrOutputWithContext(context.Background())
}
func (o DefaultSubnetOutput) ToDefaultSubnetPtrOutputWithContext(ctx context.Context) DefaultSubnetPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v DefaultSubnet) *DefaultSubnet {
return &v
}).(DefaultSubnetPtrOutput)
}
type DefaultSubnetPtrOutput struct{ *pulumi.OutputState }
func (DefaultSubnetPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**DefaultSubnet)(nil))
}
func (o DefaultSubnetPtrOutput) ToDefaultSubnetPtrOutput() DefaultSubnetPtrOutput {
return o
}
func (o DefaultSubnetPtrOutput) ToDefaultSubnetPtrOutputWithContext(ctx context.Context) DefaultSubnetPtrOutput {
return o
}
func (o DefaultSubnetPtrOutput) Elem() DefaultSubnetOutput {
return o.ApplyT(func(v *DefaultSubnet) DefaultSubnet {
if v != nil {
return *v
}
var ret DefaultSubnet
return ret
}).(DefaultSubnetOutput)
}
type DefaultSubnetArrayOutput struct{ *pulumi.OutputState }
func (DefaultSubnetArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]DefaultSubnet)(nil))
}
func (o DefaultSubnetArrayOutput) ToDefaultSubnetArrayOutput() DefaultSubnetArrayOutput {
return o
}
func (o DefaultSubnetArrayOutput) ToDefaultSubnetArrayOutputWithContext(ctx context.Context) DefaultSubnetArrayOutput {
return o
}
func (o DefaultSubnetArrayOutput) Index(i pulumi.IntInput) DefaultSubnetOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) DefaultSubnet {
return vs[0].([]DefaultSubnet)[vs[1].(int)]
}).(DefaultSubnetOutput)
}
type DefaultSubnetMapOutput struct{ *pulumi.OutputState }
func (DefaultSubnetMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]DefaultSubnet)(nil))
}
func (o DefaultSubnetMapOutput) ToDefaultSubnetMapOutput() DefaultSubnetMapOutput {
return o
}
func (o DefaultSubnetMapOutput) ToDefaultSubnetMapOutputWithContext(ctx context.Context) DefaultSubnetMapOutput {
return o
}
func (o DefaultSubnetMapOutput) MapIndex(k pulumi.StringInput) DefaultSubnetOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) DefaultSubnet {
return vs[0].(map[string]DefaultSubnet)[vs[1].(string)]
}).(DefaultSubnetOutput)
}
func init() {
pulumi.RegisterOutputType(DefaultSubnetOutput{})
pulumi.RegisterOutputType(DefaultSubnetPtrOutput{})
pulumi.RegisterOutputType(DefaultSubnetArrayOutput{})
pulumi.RegisterOutputType(DefaultSubnetMapOutput{})
}