1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. getIpamPreviewNextCidr

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.ec2.getIpamPreviewNextCidr

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    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 use ignore_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:

    IpamPoolId string
    ID of the pool to which you want to assign a CIDR.
    DisallowedCidrs List<string>
    Exclude a particular CIDR range from being returned by the pool.
    NetmaskLength int
    Netmask length of the CIDR you would like to preview from the IPAM pool.
    IpamPoolId string
    ID of the pool to which you want to assign a CIDR.
    DisallowedCidrs []string
    Exclude a particular CIDR range from being returned by the pool.
    NetmaskLength int
    Netmask length of the CIDR you would like to preview from the IPAM pool.
    ipamPoolId String
    ID of the pool to which you want to assign a CIDR.
    disallowedCidrs List<String>
    Exclude a particular CIDR range from being returned by the pool.
    netmaskLength Integer
    Netmask length of the CIDR you would like to preview from the IPAM pool.
    ipamPoolId string
    ID of the pool to which you want to assign a CIDR.
    disallowedCidrs string[]
    Exclude a particular CIDR range from being returned by the pool.
    netmaskLength number
    Netmask length of the CIDR you would like to preview from the IPAM pool.
    ipam_pool_id str
    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.
    ipamPoolId String
    ID of the pool to which you want to assign a CIDR.
    disallowedCidrs List<String>
    Exclude a particular CIDR range from being returned by the pool.
    netmaskLength 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.
    IpamPoolId string
    DisallowedCidrs List<string>
    NetmaskLength int
    Cidr string
    Previewed CIDR from the pool.
    Id string
    The provider-assigned unique ID for this managed resource.
    IpamPoolId string
    DisallowedCidrs []string
    NetmaskLength int
    cidr String
    Previewed CIDR from the pool.
    id String
    The provider-assigned unique ID for this managed resource.
    ipamPoolId String
    disallowedCidrs List<String>
    netmaskLength Integer
    cidr string
    Previewed CIDR from the pool.
    id string
    The provider-assigned unique ID for this managed resource.
    ipamPoolId string
    disallowedCidrs string[]
    netmaskLength number
    cidr str
    Previewed CIDR from the pool.
    id str
    The provider-assigned unique ID for this managed resource.
    ipam_pool_id str
    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.
    ipamPoolId String
    disallowedCidrs List<String>
    netmaskLength Number

    Package Details

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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi