github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/vpcIpamPoolCidr.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package ec2 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provisions a CIDR from an IPAM address pool. 16 // 17 // > **NOTE:** Provisioning Public IPv4 or Public IPv6 require [steps outside the scope of this resource](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-byoip.html#prepare-for-byoip). The resource accepts `message` and `signature` as part of the `cidrAuthorizationContext` attribute but those must be generated ahead of time. Public IPv6 CIDRs that are provisioned into a Pool with `publiclyAdvertisable = true` and all public IPv4 CIDRs also require creating a Route Origin Authorization (ROA) object in your Regional Internet Registry (RIR). 18 // 19 // > **NOTE:** In order to deprovision CIDRs all Allocations must be released. Allocations created by a VPC take up to 30 minutes to be released. However, for IPAM to properly manage the removal of allocation records created by VPCs and other resources, you must [grant it permissions](https://docs.aws.amazon.com/vpc/latest/ipam/choose-single-user-or-orgs-ipam.html) in 20 // either a single account or organizationally. If you are unable to deprovision a cidr after waiting over 30 minutes, you may be missing the Service Linked Role. 21 // 22 // ## Example Usage 23 // 24 // Basic usage: 25 // 26 // <!--Start PulumiCodeChooser --> 27 // ```go 28 // package main 29 // 30 // import ( 31 // 32 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 33 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 34 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 35 // 36 // ) 37 // 38 // func main() { 39 // pulumi.Run(func(ctx *pulumi.Context) error { 40 // current, err := aws.GetRegion(ctx, nil, nil) 41 // if err != nil { 42 // return err 43 // } 44 // example, err := ec2.NewVpcIpam(ctx, "example", &ec2.VpcIpamArgs{ 45 // OperatingRegions: ec2.VpcIpamOperatingRegionArray{ 46 // &ec2.VpcIpamOperatingRegionArgs{ 47 // RegionName: pulumi.String(current.Name), 48 // }, 49 // }, 50 // }) 51 // if err != nil { 52 // return err 53 // } 54 // exampleVpcIpamPool, err := ec2.NewVpcIpamPool(ctx, "example", &ec2.VpcIpamPoolArgs{ 55 // AddressFamily: pulumi.String("ipv4"), 56 // IpamScopeId: example.PrivateDefaultScopeId, 57 // Locale: pulumi.String(current.Name), 58 // }) 59 // if err != nil { 60 // return err 61 // } 62 // _, err = ec2.NewVpcIpamPoolCidr(ctx, "example", &ec2.VpcIpamPoolCidrArgs{ 63 // IpamPoolId: exampleVpcIpamPool.ID(), 64 // Cidr: pulumi.String("172.20.0.0/16"), 65 // }) 66 // if err != nil { 67 // return err 68 // } 69 // return nil 70 // }) 71 // } 72 // 73 // ``` 74 // <!--End PulumiCodeChooser --> 75 // 76 // Provision Public IPv6 Pool CIDRs: 77 // 78 // <!--Start PulumiCodeChooser --> 79 // ```go 80 // package main 81 // 82 // import ( 83 // 84 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 85 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 86 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 87 // 88 // ) 89 // 90 // func main() { 91 // pulumi.Run(func(ctx *pulumi.Context) error { 92 // current, err := aws.GetRegion(ctx, nil, nil) 93 // if err != nil { 94 // return err 95 // } 96 // example, err := ec2.NewVpcIpam(ctx, "example", &ec2.VpcIpamArgs{ 97 // OperatingRegions: ec2.VpcIpamOperatingRegionArray{ 98 // &ec2.VpcIpamOperatingRegionArgs{ 99 // RegionName: pulumi.String(current.Name), 100 // }, 101 // }, 102 // }) 103 // if err != nil { 104 // return err 105 // } 106 // ipv6TestPublic, err := ec2.NewVpcIpamPool(ctx, "ipv6_test_public", &ec2.VpcIpamPoolArgs{ 107 // AddressFamily: pulumi.String("ipv6"), 108 // IpamScopeId: example.PublicDefaultScopeId, 109 // Locale: pulumi.String("us-east-1"), 110 // Description: pulumi.String("public ipv6"), 111 // PubliclyAdvertisable: pulumi.Bool(false), 112 // PublicIpSource: pulumi.String("amazon"), 113 // AwsService: pulumi.String("ec2"), 114 // }) 115 // if err != nil { 116 // return err 117 // } 118 // _, err = ec2.NewVpcIpamPoolCidr(ctx, "ipv6_test_public", &ec2.VpcIpamPoolCidrArgs{ 119 // IpamPoolId: ipv6TestPublic.ID(), 120 // NetmaskLength: pulumi.Int(52), 121 // }) 122 // if err != nil { 123 // return err 124 // } 125 // return nil 126 // }) 127 // } 128 // 129 // ``` 130 // <!--End PulumiCodeChooser --> 131 // 132 // ## Import 133 // 134 // Using `pulumi import`, import IPAMs using the `<cidr>_<ipam-pool-id>`. For example: 135 // 136 // __NOTE:__ Do not use the IPAM Pool Cidr ID as this was introduced after the resource already existed. 137 // 138 // ```sh 139 // $ pulumi import aws:ec2/vpcIpamPoolCidr:VpcIpamPoolCidr example 172.20.0.0/24_ipam-pool-0e634f5a1517cccdc 140 // ``` 141 type VpcIpamPoolCidr struct { 142 pulumi.CustomResourceState 143 144 // The CIDR you want to assign to the pool. Conflicts with `netmaskLength`. 145 Cidr pulumi.StringOutput `pulumi:"cidr"` 146 // A signed document that proves that you are authorized to bring the specified IP address range to Amazon using BYOIP. This is not stored in the state file. See cidrAuthorizationContext for more information. 147 CidrAuthorizationContext VpcIpamPoolCidrCidrAuthorizationContextPtrOutput `pulumi:"cidrAuthorizationContext"` 148 // The unique ID generated by AWS for the pool cidr. Typically this is the resource `id` but this attribute was added to the API calls after the fact and is therefore not used as the resource id. 149 IpamPoolCidrId pulumi.StringOutput `pulumi:"ipamPoolCidrId"` 150 // The ID of the pool to which you want to assign a CIDR. 151 IpamPoolId pulumi.StringOutput `pulumi:"ipamPoolId"` 152 // If provided, the cidr provisioned into the specified pool will be the next available cidr given this declared netmask length. Conflicts with `cidr`. 153 NetmaskLength pulumi.IntPtrOutput `pulumi:"netmaskLength"` 154 } 155 156 // NewVpcIpamPoolCidr registers a new resource with the given unique name, arguments, and options. 157 func NewVpcIpamPoolCidr(ctx *pulumi.Context, 158 name string, args *VpcIpamPoolCidrArgs, opts ...pulumi.ResourceOption) (*VpcIpamPoolCidr, error) { 159 if args == nil { 160 return nil, errors.New("missing one or more required arguments") 161 } 162 163 if args.IpamPoolId == nil { 164 return nil, errors.New("invalid value for required argument 'IpamPoolId'") 165 } 166 opts = internal.PkgResourceDefaultOpts(opts) 167 var resource VpcIpamPoolCidr 168 err := ctx.RegisterResource("aws:ec2/vpcIpamPoolCidr:VpcIpamPoolCidr", name, args, &resource, opts...) 169 if err != nil { 170 return nil, err 171 } 172 return &resource, nil 173 } 174 175 // GetVpcIpamPoolCidr gets an existing VpcIpamPoolCidr resource's state with the given name, ID, and optional 176 // state properties that are used to uniquely qualify the lookup (nil if not required). 177 func GetVpcIpamPoolCidr(ctx *pulumi.Context, 178 name string, id pulumi.IDInput, state *VpcIpamPoolCidrState, opts ...pulumi.ResourceOption) (*VpcIpamPoolCidr, error) { 179 var resource VpcIpamPoolCidr 180 err := ctx.ReadResource("aws:ec2/vpcIpamPoolCidr:VpcIpamPoolCidr", name, id, state, &resource, opts...) 181 if err != nil { 182 return nil, err 183 } 184 return &resource, nil 185 } 186 187 // Input properties used for looking up and filtering VpcIpamPoolCidr resources. 188 type vpcIpamPoolCidrState struct { 189 // The CIDR you want to assign to the pool. Conflicts with `netmaskLength`. 190 Cidr *string `pulumi:"cidr"` 191 // A signed document that proves that you are authorized to bring the specified IP address range to Amazon using BYOIP. This is not stored in the state file. See cidrAuthorizationContext for more information. 192 CidrAuthorizationContext *VpcIpamPoolCidrCidrAuthorizationContext `pulumi:"cidrAuthorizationContext"` 193 // The unique ID generated by AWS for the pool cidr. Typically this is the resource `id` but this attribute was added to the API calls after the fact and is therefore not used as the resource id. 194 IpamPoolCidrId *string `pulumi:"ipamPoolCidrId"` 195 // The ID of the pool to which you want to assign a CIDR. 196 IpamPoolId *string `pulumi:"ipamPoolId"` 197 // If provided, the cidr provisioned into the specified pool will be the next available cidr given this declared netmask length. Conflicts with `cidr`. 198 NetmaskLength *int `pulumi:"netmaskLength"` 199 } 200 201 type VpcIpamPoolCidrState struct { 202 // The CIDR you want to assign to the pool. Conflicts with `netmaskLength`. 203 Cidr pulumi.StringPtrInput 204 // A signed document that proves that you are authorized to bring the specified IP address range to Amazon using BYOIP. This is not stored in the state file. See cidrAuthorizationContext for more information. 205 CidrAuthorizationContext VpcIpamPoolCidrCidrAuthorizationContextPtrInput 206 // The unique ID generated by AWS for the pool cidr. Typically this is the resource `id` but this attribute was added to the API calls after the fact and is therefore not used as the resource id. 207 IpamPoolCidrId pulumi.StringPtrInput 208 // The ID of the pool to which you want to assign a CIDR. 209 IpamPoolId pulumi.StringPtrInput 210 // If provided, the cidr provisioned into the specified pool will be the next available cidr given this declared netmask length. Conflicts with `cidr`. 211 NetmaskLength pulumi.IntPtrInput 212 } 213 214 func (VpcIpamPoolCidrState) ElementType() reflect.Type { 215 return reflect.TypeOf((*vpcIpamPoolCidrState)(nil)).Elem() 216 } 217 218 type vpcIpamPoolCidrArgs struct { 219 // The CIDR you want to assign to the pool. Conflicts with `netmaskLength`. 220 Cidr *string `pulumi:"cidr"` 221 // A signed document that proves that you are authorized to bring the specified IP address range to Amazon using BYOIP. This is not stored in the state file. See cidrAuthorizationContext for more information. 222 CidrAuthorizationContext *VpcIpamPoolCidrCidrAuthorizationContext `pulumi:"cidrAuthorizationContext"` 223 // The ID of the pool to which you want to assign a CIDR. 224 IpamPoolId string `pulumi:"ipamPoolId"` 225 // If provided, the cidr provisioned into the specified pool will be the next available cidr given this declared netmask length. Conflicts with `cidr`. 226 NetmaskLength *int `pulumi:"netmaskLength"` 227 } 228 229 // The set of arguments for constructing a VpcIpamPoolCidr resource. 230 type VpcIpamPoolCidrArgs struct { 231 // The CIDR you want to assign to the pool. Conflicts with `netmaskLength`. 232 Cidr pulumi.StringPtrInput 233 // A signed document that proves that you are authorized to bring the specified IP address range to Amazon using BYOIP. This is not stored in the state file. See cidrAuthorizationContext for more information. 234 CidrAuthorizationContext VpcIpamPoolCidrCidrAuthorizationContextPtrInput 235 // The ID of the pool to which you want to assign a CIDR. 236 IpamPoolId pulumi.StringInput 237 // If provided, the cidr provisioned into the specified pool will be the next available cidr given this declared netmask length. Conflicts with `cidr`. 238 NetmaskLength pulumi.IntPtrInput 239 } 240 241 func (VpcIpamPoolCidrArgs) ElementType() reflect.Type { 242 return reflect.TypeOf((*vpcIpamPoolCidrArgs)(nil)).Elem() 243 } 244 245 type VpcIpamPoolCidrInput interface { 246 pulumi.Input 247 248 ToVpcIpamPoolCidrOutput() VpcIpamPoolCidrOutput 249 ToVpcIpamPoolCidrOutputWithContext(ctx context.Context) VpcIpamPoolCidrOutput 250 } 251 252 func (*VpcIpamPoolCidr) ElementType() reflect.Type { 253 return reflect.TypeOf((**VpcIpamPoolCidr)(nil)).Elem() 254 } 255 256 func (i *VpcIpamPoolCidr) ToVpcIpamPoolCidrOutput() VpcIpamPoolCidrOutput { 257 return i.ToVpcIpamPoolCidrOutputWithContext(context.Background()) 258 } 259 260 func (i *VpcIpamPoolCidr) ToVpcIpamPoolCidrOutputWithContext(ctx context.Context) VpcIpamPoolCidrOutput { 261 return pulumi.ToOutputWithContext(ctx, i).(VpcIpamPoolCidrOutput) 262 } 263 264 // VpcIpamPoolCidrArrayInput is an input type that accepts VpcIpamPoolCidrArray and VpcIpamPoolCidrArrayOutput values. 265 // You can construct a concrete instance of `VpcIpamPoolCidrArrayInput` via: 266 // 267 // VpcIpamPoolCidrArray{ VpcIpamPoolCidrArgs{...} } 268 type VpcIpamPoolCidrArrayInput interface { 269 pulumi.Input 270 271 ToVpcIpamPoolCidrArrayOutput() VpcIpamPoolCidrArrayOutput 272 ToVpcIpamPoolCidrArrayOutputWithContext(context.Context) VpcIpamPoolCidrArrayOutput 273 } 274 275 type VpcIpamPoolCidrArray []VpcIpamPoolCidrInput 276 277 func (VpcIpamPoolCidrArray) ElementType() reflect.Type { 278 return reflect.TypeOf((*[]*VpcIpamPoolCidr)(nil)).Elem() 279 } 280 281 func (i VpcIpamPoolCidrArray) ToVpcIpamPoolCidrArrayOutput() VpcIpamPoolCidrArrayOutput { 282 return i.ToVpcIpamPoolCidrArrayOutputWithContext(context.Background()) 283 } 284 285 func (i VpcIpamPoolCidrArray) ToVpcIpamPoolCidrArrayOutputWithContext(ctx context.Context) VpcIpamPoolCidrArrayOutput { 286 return pulumi.ToOutputWithContext(ctx, i).(VpcIpamPoolCidrArrayOutput) 287 } 288 289 // VpcIpamPoolCidrMapInput is an input type that accepts VpcIpamPoolCidrMap and VpcIpamPoolCidrMapOutput values. 290 // You can construct a concrete instance of `VpcIpamPoolCidrMapInput` via: 291 // 292 // VpcIpamPoolCidrMap{ "key": VpcIpamPoolCidrArgs{...} } 293 type VpcIpamPoolCidrMapInput interface { 294 pulumi.Input 295 296 ToVpcIpamPoolCidrMapOutput() VpcIpamPoolCidrMapOutput 297 ToVpcIpamPoolCidrMapOutputWithContext(context.Context) VpcIpamPoolCidrMapOutput 298 } 299 300 type VpcIpamPoolCidrMap map[string]VpcIpamPoolCidrInput 301 302 func (VpcIpamPoolCidrMap) ElementType() reflect.Type { 303 return reflect.TypeOf((*map[string]*VpcIpamPoolCidr)(nil)).Elem() 304 } 305 306 func (i VpcIpamPoolCidrMap) ToVpcIpamPoolCidrMapOutput() VpcIpamPoolCidrMapOutput { 307 return i.ToVpcIpamPoolCidrMapOutputWithContext(context.Background()) 308 } 309 310 func (i VpcIpamPoolCidrMap) ToVpcIpamPoolCidrMapOutputWithContext(ctx context.Context) VpcIpamPoolCidrMapOutput { 311 return pulumi.ToOutputWithContext(ctx, i).(VpcIpamPoolCidrMapOutput) 312 } 313 314 type VpcIpamPoolCidrOutput struct{ *pulumi.OutputState } 315 316 func (VpcIpamPoolCidrOutput) ElementType() reflect.Type { 317 return reflect.TypeOf((**VpcIpamPoolCidr)(nil)).Elem() 318 } 319 320 func (o VpcIpamPoolCidrOutput) ToVpcIpamPoolCidrOutput() VpcIpamPoolCidrOutput { 321 return o 322 } 323 324 func (o VpcIpamPoolCidrOutput) ToVpcIpamPoolCidrOutputWithContext(ctx context.Context) VpcIpamPoolCidrOutput { 325 return o 326 } 327 328 // The CIDR you want to assign to the pool. Conflicts with `netmaskLength`. 329 func (o VpcIpamPoolCidrOutput) Cidr() pulumi.StringOutput { 330 return o.ApplyT(func(v *VpcIpamPoolCidr) pulumi.StringOutput { return v.Cidr }).(pulumi.StringOutput) 331 } 332 333 // A signed document that proves that you are authorized to bring the specified IP address range to Amazon using BYOIP. This is not stored in the state file. See cidrAuthorizationContext for more information. 334 func (o VpcIpamPoolCidrOutput) CidrAuthorizationContext() VpcIpamPoolCidrCidrAuthorizationContextPtrOutput { 335 return o.ApplyT(func(v *VpcIpamPoolCidr) VpcIpamPoolCidrCidrAuthorizationContextPtrOutput { 336 return v.CidrAuthorizationContext 337 }).(VpcIpamPoolCidrCidrAuthorizationContextPtrOutput) 338 } 339 340 // The unique ID generated by AWS for the pool cidr. Typically this is the resource `id` but this attribute was added to the API calls after the fact and is therefore not used as the resource id. 341 func (o VpcIpamPoolCidrOutput) IpamPoolCidrId() pulumi.StringOutput { 342 return o.ApplyT(func(v *VpcIpamPoolCidr) pulumi.StringOutput { return v.IpamPoolCidrId }).(pulumi.StringOutput) 343 } 344 345 // The ID of the pool to which you want to assign a CIDR. 346 func (o VpcIpamPoolCidrOutput) IpamPoolId() pulumi.StringOutput { 347 return o.ApplyT(func(v *VpcIpamPoolCidr) pulumi.StringOutput { return v.IpamPoolId }).(pulumi.StringOutput) 348 } 349 350 // If provided, the cidr provisioned into the specified pool will be the next available cidr given this declared netmask length. Conflicts with `cidr`. 351 func (o VpcIpamPoolCidrOutput) NetmaskLength() pulumi.IntPtrOutput { 352 return o.ApplyT(func(v *VpcIpamPoolCidr) pulumi.IntPtrOutput { return v.NetmaskLength }).(pulumi.IntPtrOutput) 353 } 354 355 type VpcIpamPoolCidrArrayOutput struct{ *pulumi.OutputState } 356 357 func (VpcIpamPoolCidrArrayOutput) ElementType() reflect.Type { 358 return reflect.TypeOf((*[]*VpcIpamPoolCidr)(nil)).Elem() 359 } 360 361 func (o VpcIpamPoolCidrArrayOutput) ToVpcIpamPoolCidrArrayOutput() VpcIpamPoolCidrArrayOutput { 362 return o 363 } 364 365 func (o VpcIpamPoolCidrArrayOutput) ToVpcIpamPoolCidrArrayOutputWithContext(ctx context.Context) VpcIpamPoolCidrArrayOutput { 366 return o 367 } 368 369 func (o VpcIpamPoolCidrArrayOutput) Index(i pulumi.IntInput) VpcIpamPoolCidrOutput { 370 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcIpamPoolCidr { 371 return vs[0].([]*VpcIpamPoolCidr)[vs[1].(int)] 372 }).(VpcIpamPoolCidrOutput) 373 } 374 375 type VpcIpamPoolCidrMapOutput struct{ *pulumi.OutputState } 376 377 func (VpcIpamPoolCidrMapOutput) ElementType() reflect.Type { 378 return reflect.TypeOf((*map[string]*VpcIpamPoolCidr)(nil)).Elem() 379 } 380 381 func (o VpcIpamPoolCidrMapOutput) ToVpcIpamPoolCidrMapOutput() VpcIpamPoolCidrMapOutput { 382 return o 383 } 384 385 func (o VpcIpamPoolCidrMapOutput) ToVpcIpamPoolCidrMapOutputWithContext(ctx context.Context) VpcIpamPoolCidrMapOutput { 386 return o 387 } 388 389 func (o VpcIpamPoolCidrMapOutput) MapIndex(k pulumi.StringInput) VpcIpamPoolCidrOutput { 390 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcIpamPoolCidr { 391 return vs[0].(map[string]*VpcIpamPoolCidr)[vs[1].(string)] 392 }).(VpcIpamPoolCidrOutput) 393 } 394 395 func init() { 396 pulumi.RegisterInputType(reflect.TypeOf((*VpcIpamPoolCidrInput)(nil)).Elem(), &VpcIpamPoolCidr{}) 397 pulumi.RegisterInputType(reflect.TypeOf((*VpcIpamPoolCidrArrayInput)(nil)).Elem(), VpcIpamPoolCidrArray{}) 398 pulumi.RegisterInputType(reflect.TypeOf((*VpcIpamPoolCidrMapInput)(nil)).Elem(), VpcIpamPoolCidrMap{}) 399 pulumi.RegisterOutputType(VpcIpamPoolCidrOutput{}) 400 pulumi.RegisterOutputType(VpcIpamPoolCidrArrayOutput{}) 401 pulumi.RegisterOutputType(VpcIpamPoolCidrMapOutput{}) 402 }