/
vpcIpv4CidrBlockAssociation.go
327 lines (266 loc) · 12.8 KB
/
vpcIpv4CidrBlockAssociation.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
// *** 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 associate additional IPv4 CIDR blocks with a VPC.
//
// When a VPC is created, a primary IPv4 CIDR block for the VPC must be specified.
// The `ec2.VpcIpv4CidrBlockAssociation` resource allows further IPv4 CIDR blocks to be added to the VPC.
//
// ## 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 {
// main, err := ec2.NewVpc(ctx, "main", &ec2.VpcArgs{
// CidrBlock: pulumi.String("10.0.0.0/16"),
// })
// if err != nil {
// return err
// }
// _, err = ec2.NewVpcIpv4CidrBlockAssociation(ctx, "secondaryCidr", &ec2.VpcIpv4CidrBlockAssociationArgs{
// VpcId: main.ID(),
// CidrBlock: pulumi.String("172.2.0.0/16"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// `aws_vpc_ipv4_cidr_block_association` can be imported by using the VPC CIDR Association ID, e.g.
//
// ```sh
// $ pulumi import aws:ec2/vpcIpv4CidrBlockAssociation:VpcIpv4CidrBlockAssociation example vpc-cidr-assoc-xxxxxxxx
// ```
type VpcIpv4CidrBlockAssociation struct {
pulumi.CustomResourceState
// The additional IPv4 CIDR block to associate with the VPC.
CidrBlock pulumi.StringOutput `pulumi:"cidrBlock"`
// The ID of the VPC to make the association with.
VpcId pulumi.StringOutput `pulumi:"vpcId"`
}
// NewVpcIpv4CidrBlockAssociation registers a new resource with the given unique name, arguments, and options.
func NewVpcIpv4CidrBlockAssociation(ctx *pulumi.Context,
name string, args *VpcIpv4CidrBlockAssociationArgs, opts ...pulumi.ResourceOption) (*VpcIpv4CidrBlockAssociation, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CidrBlock == nil {
return nil, errors.New("invalid value for required argument 'CidrBlock'")
}
if args.VpcId == nil {
return nil, errors.New("invalid value for required argument 'VpcId'")
}
var resource VpcIpv4CidrBlockAssociation
err := ctx.RegisterResource("aws:ec2/vpcIpv4CidrBlockAssociation:VpcIpv4CidrBlockAssociation", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetVpcIpv4CidrBlockAssociation gets an existing VpcIpv4CidrBlockAssociation 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 GetVpcIpv4CidrBlockAssociation(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *VpcIpv4CidrBlockAssociationState, opts ...pulumi.ResourceOption) (*VpcIpv4CidrBlockAssociation, error) {
var resource VpcIpv4CidrBlockAssociation
err := ctx.ReadResource("aws:ec2/vpcIpv4CidrBlockAssociation:VpcIpv4CidrBlockAssociation", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering VpcIpv4CidrBlockAssociation resources.
type vpcIpv4CidrBlockAssociationState struct {
// The additional IPv4 CIDR block to associate with the VPC.
CidrBlock *string `pulumi:"cidrBlock"`
// The ID of the VPC to make the association with.
VpcId *string `pulumi:"vpcId"`
}
type VpcIpv4CidrBlockAssociationState struct {
// The additional IPv4 CIDR block to associate with the VPC.
CidrBlock pulumi.StringPtrInput
// The ID of the VPC to make the association with.
VpcId pulumi.StringPtrInput
}
func (VpcIpv4CidrBlockAssociationState) ElementType() reflect.Type {
return reflect.TypeOf((*vpcIpv4CidrBlockAssociationState)(nil)).Elem()
}
type vpcIpv4CidrBlockAssociationArgs struct {
// The additional IPv4 CIDR block to associate with the VPC.
CidrBlock string `pulumi:"cidrBlock"`
// The ID of the VPC to make the association with.
VpcId string `pulumi:"vpcId"`
}
// The set of arguments for constructing a VpcIpv4CidrBlockAssociation resource.
type VpcIpv4CidrBlockAssociationArgs struct {
// The additional IPv4 CIDR block to associate with the VPC.
CidrBlock pulumi.StringInput
// The ID of the VPC to make the association with.
VpcId pulumi.StringInput
}
func (VpcIpv4CidrBlockAssociationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*vpcIpv4CidrBlockAssociationArgs)(nil)).Elem()
}
type VpcIpv4CidrBlockAssociationInput interface {
pulumi.Input
ToVpcIpv4CidrBlockAssociationOutput() VpcIpv4CidrBlockAssociationOutput
ToVpcIpv4CidrBlockAssociationOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationOutput
}
func (*VpcIpv4CidrBlockAssociation) ElementType() reflect.Type {
return reflect.TypeOf((*VpcIpv4CidrBlockAssociation)(nil))
}
func (i *VpcIpv4CidrBlockAssociation) ToVpcIpv4CidrBlockAssociationOutput() VpcIpv4CidrBlockAssociationOutput {
return i.ToVpcIpv4CidrBlockAssociationOutputWithContext(context.Background())
}
func (i *VpcIpv4CidrBlockAssociation) ToVpcIpv4CidrBlockAssociationOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpcIpv4CidrBlockAssociationOutput)
}
func (i *VpcIpv4CidrBlockAssociation) ToVpcIpv4CidrBlockAssociationPtrOutput() VpcIpv4CidrBlockAssociationPtrOutput {
return i.ToVpcIpv4CidrBlockAssociationPtrOutputWithContext(context.Background())
}
func (i *VpcIpv4CidrBlockAssociation) ToVpcIpv4CidrBlockAssociationPtrOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpcIpv4CidrBlockAssociationPtrOutput)
}
type VpcIpv4CidrBlockAssociationPtrInput interface {
pulumi.Input
ToVpcIpv4CidrBlockAssociationPtrOutput() VpcIpv4CidrBlockAssociationPtrOutput
ToVpcIpv4CidrBlockAssociationPtrOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationPtrOutput
}
type vpcIpv4CidrBlockAssociationPtrType VpcIpv4CidrBlockAssociationArgs
func (*vpcIpv4CidrBlockAssociationPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**VpcIpv4CidrBlockAssociation)(nil))
}
func (i *vpcIpv4CidrBlockAssociationPtrType) ToVpcIpv4CidrBlockAssociationPtrOutput() VpcIpv4CidrBlockAssociationPtrOutput {
return i.ToVpcIpv4CidrBlockAssociationPtrOutputWithContext(context.Background())
}
func (i *vpcIpv4CidrBlockAssociationPtrType) ToVpcIpv4CidrBlockAssociationPtrOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpcIpv4CidrBlockAssociationPtrOutput)
}
// VpcIpv4CidrBlockAssociationArrayInput is an input type that accepts VpcIpv4CidrBlockAssociationArray and VpcIpv4CidrBlockAssociationArrayOutput values.
// You can construct a concrete instance of `VpcIpv4CidrBlockAssociationArrayInput` via:
//
// VpcIpv4CidrBlockAssociationArray{ VpcIpv4CidrBlockAssociationArgs{...} }
type VpcIpv4CidrBlockAssociationArrayInput interface {
pulumi.Input
ToVpcIpv4CidrBlockAssociationArrayOutput() VpcIpv4CidrBlockAssociationArrayOutput
ToVpcIpv4CidrBlockAssociationArrayOutputWithContext(context.Context) VpcIpv4CidrBlockAssociationArrayOutput
}
type VpcIpv4CidrBlockAssociationArray []VpcIpv4CidrBlockAssociationInput
func (VpcIpv4CidrBlockAssociationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*VpcIpv4CidrBlockAssociation)(nil)).Elem()
}
func (i VpcIpv4CidrBlockAssociationArray) ToVpcIpv4CidrBlockAssociationArrayOutput() VpcIpv4CidrBlockAssociationArrayOutput {
return i.ToVpcIpv4CidrBlockAssociationArrayOutputWithContext(context.Background())
}
func (i VpcIpv4CidrBlockAssociationArray) ToVpcIpv4CidrBlockAssociationArrayOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpcIpv4CidrBlockAssociationArrayOutput)
}
// VpcIpv4CidrBlockAssociationMapInput is an input type that accepts VpcIpv4CidrBlockAssociationMap and VpcIpv4CidrBlockAssociationMapOutput values.
// You can construct a concrete instance of `VpcIpv4CidrBlockAssociationMapInput` via:
//
// VpcIpv4CidrBlockAssociationMap{ "key": VpcIpv4CidrBlockAssociationArgs{...} }
type VpcIpv4CidrBlockAssociationMapInput interface {
pulumi.Input
ToVpcIpv4CidrBlockAssociationMapOutput() VpcIpv4CidrBlockAssociationMapOutput
ToVpcIpv4CidrBlockAssociationMapOutputWithContext(context.Context) VpcIpv4CidrBlockAssociationMapOutput
}
type VpcIpv4CidrBlockAssociationMap map[string]VpcIpv4CidrBlockAssociationInput
func (VpcIpv4CidrBlockAssociationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*VpcIpv4CidrBlockAssociation)(nil)).Elem()
}
func (i VpcIpv4CidrBlockAssociationMap) ToVpcIpv4CidrBlockAssociationMapOutput() VpcIpv4CidrBlockAssociationMapOutput {
return i.ToVpcIpv4CidrBlockAssociationMapOutputWithContext(context.Background())
}
func (i VpcIpv4CidrBlockAssociationMap) ToVpcIpv4CidrBlockAssociationMapOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpcIpv4CidrBlockAssociationMapOutput)
}
type VpcIpv4CidrBlockAssociationOutput struct{ *pulumi.OutputState }
func (VpcIpv4CidrBlockAssociationOutput) ElementType() reflect.Type {
return reflect.TypeOf((*VpcIpv4CidrBlockAssociation)(nil))
}
func (o VpcIpv4CidrBlockAssociationOutput) ToVpcIpv4CidrBlockAssociationOutput() VpcIpv4CidrBlockAssociationOutput {
return o
}
func (o VpcIpv4CidrBlockAssociationOutput) ToVpcIpv4CidrBlockAssociationOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationOutput {
return o
}
func (o VpcIpv4CidrBlockAssociationOutput) ToVpcIpv4CidrBlockAssociationPtrOutput() VpcIpv4CidrBlockAssociationPtrOutput {
return o.ToVpcIpv4CidrBlockAssociationPtrOutputWithContext(context.Background())
}
func (o VpcIpv4CidrBlockAssociationOutput) ToVpcIpv4CidrBlockAssociationPtrOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v VpcIpv4CidrBlockAssociation) *VpcIpv4CidrBlockAssociation {
return &v
}).(VpcIpv4CidrBlockAssociationPtrOutput)
}
type VpcIpv4CidrBlockAssociationPtrOutput struct{ *pulumi.OutputState }
func (VpcIpv4CidrBlockAssociationPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**VpcIpv4CidrBlockAssociation)(nil))
}
func (o VpcIpv4CidrBlockAssociationPtrOutput) ToVpcIpv4CidrBlockAssociationPtrOutput() VpcIpv4CidrBlockAssociationPtrOutput {
return o
}
func (o VpcIpv4CidrBlockAssociationPtrOutput) ToVpcIpv4CidrBlockAssociationPtrOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationPtrOutput {
return o
}
func (o VpcIpv4CidrBlockAssociationPtrOutput) Elem() VpcIpv4CidrBlockAssociationOutput {
return o.ApplyT(func(v *VpcIpv4CidrBlockAssociation) VpcIpv4CidrBlockAssociation {
if v != nil {
return *v
}
var ret VpcIpv4CidrBlockAssociation
return ret
}).(VpcIpv4CidrBlockAssociationOutput)
}
type VpcIpv4CidrBlockAssociationArrayOutput struct{ *pulumi.OutputState }
func (VpcIpv4CidrBlockAssociationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]VpcIpv4CidrBlockAssociation)(nil))
}
func (o VpcIpv4CidrBlockAssociationArrayOutput) ToVpcIpv4CidrBlockAssociationArrayOutput() VpcIpv4CidrBlockAssociationArrayOutput {
return o
}
func (o VpcIpv4CidrBlockAssociationArrayOutput) ToVpcIpv4CidrBlockAssociationArrayOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationArrayOutput {
return o
}
func (o VpcIpv4CidrBlockAssociationArrayOutput) Index(i pulumi.IntInput) VpcIpv4CidrBlockAssociationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) VpcIpv4CidrBlockAssociation {
return vs[0].([]VpcIpv4CidrBlockAssociation)[vs[1].(int)]
}).(VpcIpv4CidrBlockAssociationOutput)
}
type VpcIpv4CidrBlockAssociationMapOutput struct{ *pulumi.OutputState }
func (VpcIpv4CidrBlockAssociationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]VpcIpv4CidrBlockAssociation)(nil))
}
func (o VpcIpv4CidrBlockAssociationMapOutput) ToVpcIpv4CidrBlockAssociationMapOutput() VpcIpv4CidrBlockAssociationMapOutput {
return o
}
func (o VpcIpv4CidrBlockAssociationMapOutput) ToVpcIpv4CidrBlockAssociationMapOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationMapOutput {
return o
}
func (o VpcIpv4CidrBlockAssociationMapOutput) MapIndex(k pulumi.StringInput) VpcIpv4CidrBlockAssociationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) VpcIpv4CidrBlockAssociation {
return vs[0].(map[string]VpcIpv4CidrBlockAssociation)[vs[1].(string)]
}).(VpcIpv4CidrBlockAssociationOutput)
}
func init() {
pulumi.RegisterOutputType(VpcIpv4CidrBlockAssociationOutput{})
pulumi.RegisterOutputType(VpcIpv4CidrBlockAssociationPtrOutput{})
pulumi.RegisterOutputType(VpcIpv4CidrBlockAssociationArrayOutput{})
pulumi.RegisterOutputType(VpcIpv4CidrBlockAssociationMapOutput{})
}