/
getVpcIpamPool.go
277 lines (243 loc) · 11.6 KB
/
getVpcIpamPool.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
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package ec2
import (
"context"
"reflect"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// `ec2.VpcIpamPool` provides details about an IPAM pool.
//
// This resource can prove useful when an ipam pool was created in another root
// module and you need the pool's id as an input variable. For example, pools
// can be shared via RAM and used to create vpcs with CIDRs from that pool.
//
// ## Example Usage
//
// The following example shows an account that has only 1 pool, perhaps shared
// via RAM, and using that pool id to create a VPC with a CIDR derived from
// AWS IPAM.
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// test, err := ec2.LookupVpcIpamPool(ctx, &ec2.LookupVpcIpamPoolArgs{
// Filters: []ec2.GetVpcIpamPoolFilter{
// {
// Name: "description",
// Values: []string{
// "*test*",
// },
// },
// {
// Name: "address-family",
// Values: []string{
// "ipv4",
// },
// },
// },
// }, nil)
// if err != nil {
// return err
// }
// _, err = ec2.NewVpc(ctx, "test", &ec2.VpcArgs{
// Ipv4IpamPoolId: pulumi.String(test.Id),
// Ipv4NetmaskLength: pulumi.Int(28),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
func LookupVpcIpamPool(ctx *pulumi.Context, args *LookupVpcIpamPoolArgs, opts ...pulumi.InvokeOption) (*LookupVpcIpamPoolResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupVpcIpamPoolResult
err := ctx.Invoke("aws:ec2/getVpcIpamPool:getVpcIpamPool", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getVpcIpamPool.
type LookupVpcIpamPoolArgs struct {
// Tags that are required to create resources in using this pool.
AllocationResourceTags map[string]string `pulumi:"allocationResourceTags"`
// Custom filter block as described below.
Filters []GetVpcIpamPoolFilter `pulumi:"filters"`
// ID of the IPAM pool.
Id *string `pulumi:"id"`
// ID of the IPAM pool you would like information on.
IpamPoolId *string `pulumi:"ipamPoolId"`
// Map of tags to assigned to the resource.
Tags map[string]string `pulumi:"tags"`
}
// A collection of values returned by getVpcIpamPool.
type LookupVpcIpamPoolResult struct {
// IP protocol assigned to this pool.
AddressFamily string `pulumi:"addressFamily"`
// A default netmask length for allocations added to this pool. If, for example, the CIDR assigned to this pool is `10.0.0.0/8` and you enter 16 here, new allocations will default to `10.0.0.0/16`.
AllocationDefaultNetmaskLength int `pulumi:"allocationDefaultNetmaskLength"`
// The maximum netmask length that will be required for CIDR allocations in this pool.
AllocationMaxNetmaskLength int `pulumi:"allocationMaxNetmaskLength"`
// The minimum netmask length that will be required for CIDR allocations in this pool.
AllocationMinNetmaskLength int `pulumi:"allocationMinNetmaskLength"`
// Tags that are required to create resources in using this pool.
AllocationResourceTags map[string]string `pulumi:"allocationResourceTags"`
// ARN of the pool
Arn string `pulumi:"arn"`
// If enabled, IPAM will continuously look for resources within the CIDR range of this pool and automatically import them as allocations into your IPAM.
AutoImport bool `pulumi:"autoImport"`
// Limits which service in AWS that the pool can be used in. `ec2` for example, allows users to use space for Elastic IP addresses and VPCs.
AwsService string `pulumi:"awsService"`
// Description for the IPAM pool.
Description string `pulumi:"description"`
Filters []GetVpcIpamPoolFilter `pulumi:"filters"`
// ID of the IPAM pool.
Id *string `pulumi:"id"`
IpamPoolId *string `pulumi:"ipamPoolId"`
// ID of the scope the pool belongs to.
IpamScopeId string `pulumi:"ipamScopeId"`
IpamScopeType string `pulumi:"ipamScopeType"`
// Locale is the Region where your pool is available for allocations. You can only create pools with locales that match the operating Regions of the IPAM. You can only create VPCs from a pool whose locale matches the VPC's Region.
Locale string `pulumi:"locale"`
PoolDepth int `pulumi:"poolDepth"`
// Defines whether or not IPv6 pool space is publicly advertisable over the internet.
PubliclyAdvertisable bool `pulumi:"publiclyAdvertisable"`
// ID of the source IPAM pool.
SourceIpamPoolId string `pulumi:"sourceIpamPoolId"`
State string `pulumi:"state"`
// Map of tags to assigned to the resource.
Tags map[string]string `pulumi:"tags"`
}
func LookupVpcIpamPoolOutput(ctx *pulumi.Context, args LookupVpcIpamPoolOutputArgs, opts ...pulumi.InvokeOption) LookupVpcIpamPoolResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupVpcIpamPoolResult, error) {
args := v.(LookupVpcIpamPoolArgs)
r, err := LookupVpcIpamPool(ctx, &args, opts...)
var s LookupVpcIpamPoolResult
if r != nil {
s = *r
}
return s, err
}).(LookupVpcIpamPoolResultOutput)
}
// A collection of arguments for invoking getVpcIpamPool.
type LookupVpcIpamPoolOutputArgs struct {
// Tags that are required to create resources in using this pool.
AllocationResourceTags pulumi.StringMapInput `pulumi:"allocationResourceTags"`
// Custom filter block as described below.
Filters GetVpcIpamPoolFilterArrayInput `pulumi:"filters"`
// ID of the IPAM pool.
Id pulumi.StringPtrInput `pulumi:"id"`
// ID of the IPAM pool you would like information on.
IpamPoolId pulumi.StringPtrInput `pulumi:"ipamPoolId"`
// Map of tags to assigned to the resource.
Tags pulumi.StringMapInput `pulumi:"tags"`
}
func (LookupVpcIpamPoolOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupVpcIpamPoolArgs)(nil)).Elem()
}
// A collection of values returned by getVpcIpamPool.
type LookupVpcIpamPoolResultOutput struct{ *pulumi.OutputState }
func (LookupVpcIpamPoolResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupVpcIpamPoolResult)(nil)).Elem()
}
func (o LookupVpcIpamPoolResultOutput) ToLookupVpcIpamPoolResultOutput() LookupVpcIpamPoolResultOutput {
return o
}
func (o LookupVpcIpamPoolResultOutput) ToLookupVpcIpamPoolResultOutputWithContext(ctx context.Context) LookupVpcIpamPoolResultOutput {
return o
}
// IP protocol assigned to this pool.
func (o LookupVpcIpamPoolResultOutput) AddressFamily() pulumi.StringOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) string { return v.AddressFamily }).(pulumi.StringOutput)
}
// A default netmask length for allocations added to this pool. If, for example, the CIDR assigned to this pool is `10.0.0.0/8` and you enter 16 here, new allocations will default to `10.0.0.0/16`.
func (o LookupVpcIpamPoolResultOutput) AllocationDefaultNetmaskLength() pulumi.IntOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) int { return v.AllocationDefaultNetmaskLength }).(pulumi.IntOutput)
}
// The maximum netmask length that will be required for CIDR allocations in this pool.
func (o LookupVpcIpamPoolResultOutput) AllocationMaxNetmaskLength() pulumi.IntOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) int { return v.AllocationMaxNetmaskLength }).(pulumi.IntOutput)
}
// The minimum netmask length that will be required for CIDR allocations in this pool.
func (o LookupVpcIpamPoolResultOutput) AllocationMinNetmaskLength() pulumi.IntOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) int { return v.AllocationMinNetmaskLength }).(pulumi.IntOutput)
}
// Tags that are required to create resources in using this pool.
func (o LookupVpcIpamPoolResultOutput) AllocationResourceTags() pulumi.StringMapOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) map[string]string { return v.AllocationResourceTags }).(pulumi.StringMapOutput)
}
// ARN of the pool
func (o LookupVpcIpamPoolResultOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) string { return v.Arn }).(pulumi.StringOutput)
}
// If enabled, IPAM will continuously look for resources within the CIDR range of this pool and automatically import them as allocations into your IPAM.
func (o LookupVpcIpamPoolResultOutput) AutoImport() pulumi.BoolOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) bool { return v.AutoImport }).(pulumi.BoolOutput)
}
// Limits which service in AWS that the pool can be used in. `ec2` for example, allows users to use space for Elastic IP addresses and VPCs.
func (o LookupVpcIpamPoolResultOutput) AwsService() pulumi.StringOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) string { return v.AwsService }).(pulumi.StringOutput)
}
// Description for the IPAM pool.
func (o LookupVpcIpamPoolResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) string { return v.Description }).(pulumi.StringOutput)
}
func (o LookupVpcIpamPoolResultOutput) Filters() GetVpcIpamPoolFilterArrayOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) []GetVpcIpamPoolFilter { return v.Filters }).(GetVpcIpamPoolFilterArrayOutput)
}
// ID of the IPAM pool.
func (o LookupVpcIpamPoolResultOutput) Id() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) *string { return v.Id }).(pulumi.StringPtrOutput)
}
func (o LookupVpcIpamPoolResultOutput) IpamPoolId() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) *string { return v.IpamPoolId }).(pulumi.StringPtrOutput)
}
// ID of the scope the pool belongs to.
func (o LookupVpcIpamPoolResultOutput) IpamScopeId() pulumi.StringOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) string { return v.IpamScopeId }).(pulumi.StringOutput)
}
func (o LookupVpcIpamPoolResultOutput) IpamScopeType() pulumi.StringOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) string { return v.IpamScopeType }).(pulumi.StringOutput)
}
// Locale is the Region where your pool is available for allocations. You can only create pools with locales that match the operating Regions of the IPAM. You can only create VPCs from a pool whose locale matches the VPC's Region.
func (o LookupVpcIpamPoolResultOutput) Locale() pulumi.StringOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) string { return v.Locale }).(pulumi.StringOutput)
}
func (o LookupVpcIpamPoolResultOutput) PoolDepth() pulumi.IntOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) int { return v.PoolDepth }).(pulumi.IntOutput)
}
// Defines whether or not IPv6 pool space is publicly advertisable over the internet.
func (o LookupVpcIpamPoolResultOutput) PubliclyAdvertisable() pulumi.BoolOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) bool { return v.PubliclyAdvertisable }).(pulumi.BoolOutput)
}
// ID of the source IPAM pool.
func (o LookupVpcIpamPoolResultOutput) SourceIpamPoolId() pulumi.StringOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) string { return v.SourceIpamPoolId }).(pulumi.StringOutput)
}
func (o LookupVpcIpamPoolResultOutput) State() pulumi.StringOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) string { return v.State }).(pulumi.StringOutput)
}
// Map of tags to assigned to the resource.
func (o LookupVpcIpamPoolResultOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v LookupVpcIpamPoolResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
}
func init() {
pulumi.RegisterOutputType(LookupVpcIpamPoolResultOutput{})
}