Try AWS Native preview for resources not in the classic version.
aws.ec2.getIpamPreviewNextCidr
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Previews a CIDR from an IPAM address pool. Only works for private IPv4.
NOTE: This functionality is also encapsulated in a resource sharing the same name. The data source can be used when you need to use the cidr in a calculation of the same Root module,
count
for example. However, once a cidr range has been allocated that was previewed, the next refresh will find a new cidr and may force new resources downstream. Make sure to useignore_changes
if this is undesirable.
Example Usage
Basic usage:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = aws.ec2.getIpamPreviewNextCidr({
ipamPoolId: testAwsVpcIpamPool.id,
netmaskLength: 28,
});
const testVpcIpamPoolCidrAllocation = new aws.ec2.VpcIpamPoolCidrAllocation("test", {
ipamPoolId: testAwsVpcIpamPool.id,
cidr: test.then(test => test.cidr),
});
import pulumi
import pulumi_aws as aws
test = aws.ec2.get_ipam_preview_next_cidr(ipam_pool_id=test_aws_vpc_ipam_pool["id"],
netmask_length=28)
test_vpc_ipam_pool_cidr_allocation = aws.ec2.VpcIpamPoolCidrAllocation("test",
ipam_pool_id=test_aws_vpc_ipam_pool["id"],
cidr=test.cidr)
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.GetIpamPreviewNextCidr(ctx, &ec2.GetIpamPreviewNextCidrArgs{
IpamPoolId: testAwsVpcIpamPool.Id,
NetmaskLength: pulumi.IntRef(28),
}, nil)
if err != nil {
return err
}
_, err = ec2.NewVpcIpamPoolCidrAllocation(ctx, "test", &ec2.VpcIpamPoolCidrAllocationArgs{
IpamPoolId: pulumi.Any(testAwsVpcIpamPool.Id),
Cidr: pulumi.String(test.Cidr),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = Aws.Ec2.GetIpamPreviewNextCidr.Invoke(new()
{
IpamPoolId = testAwsVpcIpamPool.Id,
NetmaskLength = 28,
});
var testVpcIpamPoolCidrAllocation = new Aws.Ec2.VpcIpamPoolCidrAllocation("test", new()
{
IpamPoolId = testAwsVpcIpamPool.Id,
Cidr = test.Apply(getIpamPreviewNextCidrResult => getIpamPreviewNextCidrResult.Cidr),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetIpamPreviewNextCidrArgs;
import com.pulumi.aws.ec2.VpcIpamPoolCidrAllocation;
import com.pulumi.aws.ec2.VpcIpamPoolCidrAllocationArgs;
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 test = Ec2Functions.getIpamPreviewNextCidr(GetIpamPreviewNextCidrArgs.builder()
.ipamPoolId(testAwsVpcIpamPool.id())
.netmaskLength(28)
.build());
var testVpcIpamPoolCidrAllocation = new VpcIpamPoolCidrAllocation("testVpcIpamPoolCidrAllocation", VpcIpamPoolCidrAllocationArgs.builder()
.ipamPoolId(testAwsVpcIpamPool.id())
.cidr(test.applyValue(getIpamPreviewNextCidrResult -> getIpamPreviewNextCidrResult.cidr()))
.build());
}
}
resources:
testVpcIpamPoolCidrAllocation:
type: aws:ec2:VpcIpamPoolCidrAllocation
name: test
properties:
ipamPoolId: ${testAwsVpcIpamPool.id}
cidr: ${test.cidr}
variables:
test:
fn::invoke:
Function: aws:ec2:getIpamPreviewNextCidr
Arguments:
ipamPoolId: ${testAwsVpcIpamPool.id}
netmaskLength: 28
Using getIpamPreviewNextCidr
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getIpamPreviewNextCidr(args: GetIpamPreviewNextCidrArgs, opts?: InvokeOptions): Promise<GetIpamPreviewNextCidrResult>
function getIpamPreviewNextCidrOutput(args: GetIpamPreviewNextCidrOutputArgs, opts?: InvokeOptions): Output<GetIpamPreviewNextCidrResult>
def get_ipam_preview_next_cidr(disallowed_cidrs: Optional[Sequence[str]] = None,
ipam_pool_id: Optional[str] = None,
netmask_length: Optional[int] = None,
opts: Optional[InvokeOptions] = None) -> GetIpamPreviewNextCidrResult
def get_ipam_preview_next_cidr_output(disallowed_cidrs: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
ipam_pool_id: Optional[pulumi.Input[str]] = None,
netmask_length: Optional[pulumi.Input[int]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetIpamPreviewNextCidrResult]
func GetIpamPreviewNextCidr(ctx *Context, args *GetIpamPreviewNextCidrArgs, opts ...InvokeOption) (*GetIpamPreviewNextCidrResult, error)
func GetIpamPreviewNextCidrOutput(ctx *Context, args *GetIpamPreviewNextCidrOutputArgs, opts ...InvokeOption) GetIpamPreviewNextCidrResultOutput
> Note: This function is named GetIpamPreviewNextCidr
in the Go SDK.
public static class GetIpamPreviewNextCidr
{
public static Task<GetIpamPreviewNextCidrResult> InvokeAsync(GetIpamPreviewNextCidrArgs args, InvokeOptions? opts = null)
public static Output<GetIpamPreviewNextCidrResult> Invoke(GetIpamPreviewNextCidrInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetIpamPreviewNextCidrResult> getIpamPreviewNextCidr(GetIpamPreviewNextCidrArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:ec2/getIpamPreviewNextCidr:getIpamPreviewNextCidr
arguments:
# arguments dictionary
The following arguments are supported:
- Ipam
Pool stringId - ID of the pool to which you want to assign a CIDR.
- Disallowed
Cidrs List<string> - Exclude a particular CIDR range from being returned by the pool.
- Netmask
Length int - Netmask length of the CIDR you would like to preview from the IPAM pool.
- Ipam
Pool stringId - ID of the pool to which you want to assign a CIDR.
- Disallowed
Cidrs []string - Exclude a particular CIDR range from being returned by the pool.
- Netmask
Length int - Netmask length of the CIDR you would like to preview from the IPAM pool.
- ipam
Pool StringId - ID of the pool to which you want to assign a CIDR.
- disallowed
Cidrs List<String> - Exclude a particular CIDR range from being returned by the pool.
- netmask
Length Integer - Netmask length of the CIDR you would like to preview from the IPAM pool.
- ipam
Pool stringId - ID of the pool to which you want to assign a CIDR.
- disallowed
Cidrs string[] - Exclude a particular CIDR range from being returned by the pool.
- netmask
Length number - Netmask length of the CIDR you would like to preview from the IPAM pool.
- ipam_
pool_ strid - ID of the pool to which you want to assign a CIDR.
- disallowed_
cidrs Sequence[str] - Exclude a particular CIDR range from being returned by the pool.
- netmask_
length int - Netmask length of the CIDR you would like to preview from the IPAM pool.
- ipam
Pool StringId - ID of the pool to which you want to assign a CIDR.
- disallowed
Cidrs List<String> - Exclude a particular CIDR range from being returned by the pool.
- netmask
Length Number - Netmask length of the CIDR you would like to preview from the IPAM pool.
getIpamPreviewNextCidr Result
The following output properties are available:
- Cidr string
- Previewed CIDR from the pool.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipam
Pool stringId - Disallowed
Cidrs List<string> - Netmask
Length int
- Cidr string
- Previewed CIDR from the pool.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipam
Pool stringId - Disallowed
Cidrs []string - Netmask
Length int
- cidr String
- Previewed CIDR from the pool.
- id String
- The provider-assigned unique ID for this managed resource.
- ipam
Pool StringId - disallowed
Cidrs List<String> - netmask
Length Integer
- cidr string
- Previewed CIDR from the pool.
- id string
- The provider-assigned unique ID for this managed resource.
- ipam
Pool stringId - disallowed
Cidrs string[] - netmask
Length number
- cidr str
- Previewed CIDR from the pool.
- id str
- The provider-assigned unique ID for this managed resource.
- ipam_
pool_ strid - disallowed_
cidrs Sequence[str] - netmask_
length int
- cidr String
- Previewed CIDR from the pool.
- id String
- The provider-assigned unique ID for this managed resource.
- ipam
Pool StringId - disallowed
Cidrs List<String> - netmask
Length Number
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.