1. Packages
  2. AWS
  3. API Docs
  4. ec2
  5. VpcIpamPreviewNextCidr
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.ec2.VpcIpamPreviewNextCidr

Explore with Pulumi AI

Previews a CIDR from an IPAM address pool. Only works for private IPv4.

Example Usage

Basic usage:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getRegion({});
const exampleVpcIpam = new aws.ec2.VpcIpam("example", {operatingRegions: [{
    regionName: current.then(current => current.name),
}]});
const exampleVpcIpamPool = new aws.ec2.VpcIpamPool("example", {
    addressFamily: "ipv4",
    ipamScopeId: exampleVpcIpam.privateDefaultScopeId,
    locale: current.then(current => current.name),
});
const exampleVpcIpamPoolCidr = new aws.ec2.VpcIpamPoolCidr("example", {
    ipamPoolId: exampleVpcIpamPool.id,
    cidr: "172.20.0.0/16",
});
const example = new aws.ec2.VpcIpamPreviewNextCidr("example", {
    ipamPoolId: exampleVpcIpamPool.id,
    netmaskLength: 28,
    disallowedCidrs: ["172.2.0.0/32"],
}, {
    dependsOn: [exampleVpcIpamPoolCidr],
});
Copy
import pulumi
import pulumi_aws as aws

current = aws.get_region()
example_vpc_ipam = aws.ec2.VpcIpam("example", operating_regions=[{
    "region_name": current.name,
}])
example_vpc_ipam_pool = aws.ec2.VpcIpamPool("example",
    address_family="ipv4",
    ipam_scope_id=example_vpc_ipam.private_default_scope_id,
    locale=current.name)
example_vpc_ipam_pool_cidr = aws.ec2.VpcIpamPoolCidr("example",
    ipam_pool_id=example_vpc_ipam_pool.id,
    cidr="172.20.0.0/16")
example = aws.ec2.VpcIpamPreviewNextCidr("example",
    ipam_pool_id=example_vpc_ipam_pool.id,
    netmask_length=28,
    disallowed_cidrs=["172.2.0.0/32"],
    opts = pulumi.ResourceOptions(depends_on=[example_vpc_ipam_pool_cidr]))
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
	"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 {
		current, err := aws.GetRegion(ctx, &aws.GetRegionArgs{}, nil)
		if err != nil {
			return err
		}
		exampleVpcIpam, err := ec2.NewVpcIpam(ctx, "example", &ec2.VpcIpamArgs{
			OperatingRegions: ec2.VpcIpamOperatingRegionArray{
				&ec2.VpcIpamOperatingRegionArgs{
					RegionName: pulumi.String(current.Name),
				},
			},
		})
		if err != nil {
			return err
		}
		exampleVpcIpamPool, err := ec2.NewVpcIpamPool(ctx, "example", &ec2.VpcIpamPoolArgs{
			AddressFamily: pulumi.String("ipv4"),
			IpamScopeId:   exampleVpcIpam.PrivateDefaultScopeId,
			Locale:        pulumi.String(current.Name),
		})
		if err != nil {
			return err
		}
		exampleVpcIpamPoolCidr, err := ec2.NewVpcIpamPoolCidr(ctx, "example", &ec2.VpcIpamPoolCidrArgs{
			IpamPoolId: exampleVpcIpamPool.ID(),
			Cidr:       pulumi.String("172.20.0.0/16"),
		})
		if err != nil {
			return err
		}
		_, err = ec2.NewVpcIpamPreviewNextCidr(ctx, "example", &ec2.VpcIpamPreviewNextCidrArgs{
			IpamPoolId:    exampleVpcIpamPool.ID(),
			NetmaskLength: pulumi.Int(28),
			DisallowedCidrs: pulumi.StringArray{
				pulumi.String("172.2.0.0/32"),
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			exampleVpcIpamPoolCidr,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var current = Aws.GetRegion.Invoke();

    var exampleVpcIpam = new Aws.Ec2.VpcIpam("example", new()
    {
        OperatingRegions = new[]
        {
            new Aws.Ec2.Inputs.VpcIpamOperatingRegionArgs
            {
                RegionName = current.Apply(getRegionResult => getRegionResult.Name),
            },
        },
    });

    var exampleVpcIpamPool = new Aws.Ec2.VpcIpamPool("example", new()
    {
        AddressFamily = "ipv4",
        IpamScopeId = exampleVpcIpam.PrivateDefaultScopeId,
        Locale = current.Apply(getRegionResult => getRegionResult.Name),
    });

    var exampleVpcIpamPoolCidr = new Aws.Ec2.VpcIpamPoolCidr("example", new()
    {
        IpamPoolId = exampleVpcIpamPool.Id,
        Cidr = "172.20.0.0/16",
    });

    var example = new Aws.Ec2.VpcIpamPreviewNextCidr("example", new()
    {
        IpamPoolId = exampleVpcIpamPool.Id,
        NetmaskLength = 28,
        DisallowedCidrs = new[]
        {
            "172.2.0.0/32",
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            exampleVpcIpamPoolCidr,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetRegionArgs;
import com.pulumi.aws.ec2.VpcIpam;
import com.pulumi.aws.ec2.VpcIpamArgs;
import com.pulumi.aws.ec2.inputs.VpcIpamOperatingRegionArgs;
import com.pulumi.aws.ec2.VpcIpamPool;
import com.pulumi.aws.ec2.VpcIpamPoolArgs;
import com.pulumi.aws.ec2.VpcIpamPoolCidr;
import com.pulumi.aws.ec2.VpcIpamPoolCidrArgs;
import com.pulumi.aws.ec2.VpcIpamPreviewNextCidr;
import com.pulumi.aws.ec2.VpcIpamPreviewNextCidrArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var current = AwsFunctions.getRegion();

        var exampleVpcIpam = new VpcIpam("exampleVpcIpam", VpcIpamArgs.builder()
            .operatingRegions(VpcIpamOperatingRegionArgs.builder()
                .regionName(current.applyValue(getRegionResult -> getRegionResult.name()))
                .build())
            .build());

        var exampleVpcIpamPool = new VpcIpamPool("exampleVpcIpamPool", VpcIpamPoolArgs.builder()
            .addressFamily("ipv4")
            .ipamScopeId(exampleVpcIpam.privateDefaultScopeId())
            .locale(current.applyValue(getRegionResult -> getRegionResult.name()))
            .build());

        var exampleVpcIpamPoolCidr = new VpcIpamPoolCidr("exampleVpcIpamPoolCidr", VpcIpamPoolCidrArgs.builder()
            .ipamPoolId(exampleVpcIpamPool.id())
            .cidr("172.20.0.0/16")
            .build());

        var example = new VpcIpamPreviewNextCidr("example", VpcIpamPreviewNextCidrArgs.builder()
            .ipamPoolId(exampleVpcIpamPool.id())
            .netmaskLength(28)
            .disallowedCidrs("172.2.0.0/32")
            .build(), CustomResourceOptions.builder()
                .dependsOn(exampleVpcIpamPoolCidr)
                .build());

    }
}
Copy
resources:
  example:
    type: aws:ec2:VpcIpamPreviewNextCidr
    properties:
      ipamPoolId: ${exampleVpcIpamPool.id}
      netmaskLength: 28
      disallowedCidrs:
        - 172.2.0.0/32
    options:
      dependsOn:
        - ${exampleVpcIpamPoolCidr}
  exampleVpcIpamPoolCidr:
    type: aws:ec2:VpcIpamPoolCidr
    name: example
    properties:
      ipamPoolId: ${exampleVpcIpamPool.id}
      cidr: 172.20.0.0/16
  exampleVpcIpamPool:
    type: aws:ec2:VpcIpamPool
    name: example
    properties:
      addressFamily: ipv4
      ipamScopeId: ${exampleVpcIpam.privateDefaultScopeId}
      locale: ${current.name}
  exampleVpcIpam:
    type: aws:ec2:VpcIpam
    name: example
    properties:
      operatingRegions:
        - regionName: ${current.name}
variables:
  current:
    fn::invoke:
      function: aws:getRegion
      arguments: {}
Copy

Create VpcIpamPreviewNextCidr Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new VpcIpamPreviewNextCidr(name: string, args: VpcIpamPreviewNextCidrArgs, opts?: CustomResourceOptions);
@overload
def VpcIpamPreviewNextCidr(resource_name: str,
                           args: VpcIpamPreviewNextCidrArgs,
                           opts: Optional[ResourceOptions] = None)

@overload
def VpcIpamPreviewNextCidr(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           ipam_pool_id: Optional[str] = None,
                           disallowed_cidrs: Optional[Sequence[str]] = None,
                           netmask_length: Optional[int] = None)
func NewVpcIpamPreviewNextCidr(ctx *Context, name string, args VpcIpamPreviewNextCidrArgs, opts ...ResourceOption) (*VpcIpamPreviewNextCidr, error)
public VpcIpamPreviewNextCidr(string name, VpcIpamPreviewNextCidrArgs args, CustomResourceOptions? opts = null)
public VpcIpamPreviewNextCidr(String name, VpcIpamPreviewNextCidrArgs args)
public VpcIpamPreviewNextCidr(String name, VpcIpamPreviewNextCidrArgs args, CustomResourceOptions options)
type: aws:ec2:VpcIpamPreviewNextCidr
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. VpcIpamPreviewNextCidrArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. VpcIpamPreviewNextCidrArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. VpcIpamPreviewNextCidrArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. VpcIpamPreviewNextCidrArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. VpcIpamPreviewNextCidrArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var vpcIpamPreviewNextCidrResource = new Aws.Ec2.VpcIpamPreviewNextCidr("vpcIpamPreviewNextCidrResource", new()
{
    IpamPoolId = "string",
    DisallowedCidrs = new[]
    {
        "string",
    },
    NetmaskLength = 0,
});
Copy
example, err := ec2.NewVpcIpamPreviewNextCidr(ctx, "vpcIpamPreviewNextCidrResource", &ec2.VpcIpamPreviewNextCidrArgs{
	IpamPoolId: pulumi.String("string"),
	DisallowedCidrs: pulumi.StringArray{
		pulumi.String("string"),
	},
	NetmaskLength: pulumi.Int(0),
})
Copy
var vpcIpamPreviewNextCidrResource = new VpcIpamPreviewNextCidr("vpcIpamPreviewNextCidrResource", VpcIpamPreviewNextCidrArgs.builder()
    .ipamPoolId("string")
    .disallowedCidrs("string")
    .netmaskLength(0)
    .build());
Copy
vpc_ipam_preview_next_cidr_resource = aws.ec2.VpcIpamPreviewNextCidr("vpcIpamPreviewNextCidrResource",
    ipam_pool_id="string",
    disallowed_cidrs=["string"],
    netmask_length=0)
Copy
const vpcIpamPreviewNextCidrResource = new aws.ec2.VpcIpamPreviewNextCidr("vpcIpamPreviewNextCidrResource", {
    ipamPoolId: "string",
    disallowedCidrs: ["string"],
    netmaskLength: 0,
});
Copy
type: aws:ec2:VpcIpamPreviewNextCidr
properties:
    disallowedCidrs:
        - string
    ipamPoolId: string
    netmaskLength: 0
Copy

VpcIpamPreviewNextCidr Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The VpcIpamPreviewNextCidr resource accepts the following input properties:

IpamPoolId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the pool to which you want to assign a CIDR.
DisallowedCidrs Changes to this property will trigger replacement. List<string>
Exclude a particular CIDR range from being returned by the pool.
NetmaskLength Changes to this property will trigger replacement. int
The netmask length of the CIDR you would like to preview from the IPAM pool.
IpamPoolId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the pool to which you want to assign a CIDR.
DisallowedCidrs Changes to this property will trigger replacement. []string
Exclude a particular CIDR range from being returned by the pool.
NetmaskLength Changes to this property will trigger replacement. int
The netmask length of the CIDR you would like to preview from the IPAM pool.
ipamPoolId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the pool to which you want to assign a CIDR.
disallowedCidrs Changes to this property will trigger replacement. List<String>
Exclude a particular CIDR range from being returned by the pool.
netmaskLength Changes to this property will trigger replacement. Integer
The netmask length of the CIDR you would like to preview from the IPAM pool.
ipamPoolId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the pool to which you want to assign a CIDR.
disallowedCidrs Changes to this property will trigger replacement. string[]
Exclude a particular CIDR range from being returned by the pool.
netmaskLength Changes to this property will trigger replacement. number
The netmask length of the CIDR you would like to preview from the IPAM pool.
ipam_pool_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the pool to which you want to assign a CIDR.
disallowed_cidrs Changes to this property will trigger replacement. Sequence[str]
Exclude a particular CIDR range from being returned by the pool.
netmask_length Changes to this property will trigger replacement. int
The netmask length of the CIDR you would like to preview from the IPAM pool.
ipamPoolId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the pool to which you want to assign a CIDR.
disallowedCidrs Changes to this property will trigger replacement. List<String>
Exclude a particular CIDR range from being returned by the pool.
netmaskLength Changes to this property will trigger replacement. Number
The netmask length of the CIDR you would like to preview from the IPAM pool.

Outputs

All input properties are implicitly available as output properties. Additionally, the VpcIpamPreviewNextCidr resource produces the following output properties:

Cidr string
The previewed CIDR from the pool.
Id string
The provider-assigned unique ID for this managed resource.
Cidr string
The previewed CIDR from the pool.
Id string
The provider-assigned unique ID for this managed resource.
cidr String
The previewed CIDR from the pool.
id String
The provider-assigned unique ID for this managed resource.
cidr string
The previewed CIDR from the pool.
id string
The provider-assigned unique ID for this managed resource.
cidr str
The previewed CIDR from the pool.
id str
The provider-assigned unique ID for this managed resource.
cidr String
The previewed CIDR from the pool.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing VpcIpamPreviewNextCidr Resource

Get an existing VpcIpamPreviewNextCidr resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VpcIpamPreviewNextCidrState, opts?: CustomResourceOptions): VpcIpamPreviewNextCidr
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cidr: Optional[str] = None,
        disallowed_cidrs: Optional[Sequence[str]] = None,
        ipam_pool_id: Optional[str] = None,
        netmask_length: Optional[int] = None) -> VpcIpamPreviewNextCidr
func GetVpcIpamPreviewNextCidr(ctx *Context, name string, id IDInput, state *VpcIpamPreviewNextCidrState, opts ...ResourceOption) (*VpcIpamPreviewNextCidr, error)
public static VpcIpamPreviewNextCidr Get(string name, Input<string> id, VpcIpamPreviewNextCidrState? state, CustomResourceOptions? opts = null)
public static VpcIpamPreviewNextCidr get(String name, Output<String> id, VpcIpamPreviewNextCidrState state, CustomResourceOptions options)
resources:  _:    type: aws:ec2:VpcIpamPreviewNextCidr    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Cidr string
The previewed CIDR from the pool.
DisallowedCidrs Changes to this property will trigger replacement. List<string>
Exclude a particular CIDR range from being returned by the pool.
IpamPoolId Changes to this property will trigger replacement. string
The ID of the pool to which you want to assign a CIDR.
NetmaskLength Changes to this property will trigger replacement. int
The netmask length of the CIDR you would like to preview from the IPAM pool.
Cidr string
The previewed CIDR from the pool.
DisallowedCidrs Changes to this property will trigger replacement. []string
Exclude a particular CIDR range from being returned by the pool.
IpamPoolId Changes to this property will trigger replacement. string
The ID of the pool to which you want to assign a CIDR.
NetmaskLength Changes to this property will trigger replacement. int
The netmask length of the CIDR you would like to preview from the IPAM pool.
cidr String
The previewed CIDR from the pool.
disallowedCidrs Changes to this property will trigger replacement. List<String>
Exclude a particular CIDR range from being returned by the pool.
ipamPoolId Changes to this property will trigger replacement. String
The ID of the pool to which you want to assign a CIDR.
netmaskLength Changes to this property will trigger replacement. Integer
The netmask length of the CIDR you would like to preview from the IPAM pool.
cidr string
The previewed CIDR from the pool.
disallowedCidrs Changes to this property will trigger replacement. string[]
Exclude a particular CIDR range from being returned by the pool.
ipamPoolId Changes to this property will trigger replacement. string
The ID of the pool to which you want to assign a CIDR.
netmaskLength Changes to this property will trigger replacement. number
The netmask length of the CIDR you would like to preview from the IPAM pool.
cidr str
The previewed CIDR from the pool.
disallowed_cidrs Changes to this property will trigger replacement. Sequence[str]
Exclude a particular CIDR range from being returned by the pool.
ipam_pool_id Changes to this property will trigger replacement. str
The ID of the pool to which you want to assign a CIDR.
netmask_length Changes to this property will trigger replacement. int
The netmask length of the CIDR you would like to preview from the IPAM pool.
cidr String
The previewed CIDR from the pool.
disallowedCidrs Changes to this property will trigger replacement. List<String>
Exclude a particular CIDR range from being returned by the pool.
ipamPoolId Changes to this property will trigger replacement. String
The ID of the pool to which you want to assign a CIDR.
netmaskLength Changes to this property will trigger replacement. Number
The netmask length of the CIDR you would like to preview from the IPAM pool.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.