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

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.getVpcIpamPoolCidrs

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

    aws.ec2.getVpcIpamPoolCidrs provides details about an IPAM pool.

    This resource can prove useful when an ipam pool was shared to your account and you want to know all (or a filtered list) of the CIDRs that are provisioned into the pool.

    Example Usage

    Basic usage:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const p = aws.ec2.getVpcIpamPool({
        filters: [
            {
                name: "description",
                values: ["*mypool*"],
            },
            {
                name: "address-family",
                values: ["ipv4"],
            },
        ],
    });
    const c = p.then(p => aws.ec2.getVpcIpamPoolCidrs({
        ipamPoolId: p.id,
    }));
    
    import pulumi
    import pulumi_aws as aws
    
    p = aws.ec2.get_vpc_ipam_pool(filters=[
        {
            "name": "description",
            "values": ["*mypool*"],
        },
        {
            "name": "address-family",
            "values": ["ipv4"],
        },
    ])
    c = aws.ec2.get_vpc_ipam_pool_cidrs(ipam_pool_id=p.id)
    
    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 {
    		p, err := ec2.LookupVpcIpamPool(ctx, &ec2.LookupVpcIpamPoolArgs{
    			Filters: []ec2.GetVpcIpamPoolFilter{
    				{
    					Name: "description",
    					Values: []string{
    						"*mypool*",
    					},
    				},
    				{
    					Name: "address-family",
    					Values: []string{
    						"ipv4",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = ec2.GetVpcIpamPoolCidrs(ctx, &ec2.GetVpcIpamPoolCidrsArgs{
    			IpamPoolId: p.Id,
    		}, nil)
    		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 p = Aws.Ec2.GetVpcIpamPool.Invoke(new()
        {
            Filters = new[]
            {
                new Aws.Ec2.Inputs.GetVpcIpamPoolFilterInputArgs
                {
                    Name = "description",
                    Values = new[]
                    {
                        "*mypool*",
                    },
                },
                new Aws.Ec2.Inputs.GetVpcIpamPoolFilterInputArgs
                {
                    Name = "address-family",
                    Values = new[]
                    {
                        "ipv4",
                    },
                },
            },
        });
    
        var c = Aws.Ec2.GetVpcIpamPoolCidrs.Invoke(new()
        {
            IpamPoolId = p.Apply(getVpcIpamPoolResult => getVpcIpamPoolResult.Id),
        });
    
    });
    
    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.GetVpcIpamPoolArgs;
    import com.pulumi.aws.ec2.inputs.GetVpcIpamPoolCidrsArgs;
    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 p = Ec2Functions.getVpcIpamPool(GetVpcIpamPoolArgs.builder()
                .filters(            
                    GetVpcIpamPoolFilterArgs.builder()
                        .name("description")
                        .values("*mypool*")
                        .build(),
                    GetVpcIpamPoolFilterArgs.builder()
                        .name("address-family")
                        .values("ipv4")
                        .build())
                .build());
    
            final var c = Ec2Functions.getVpcIpamPoolCidrs(GetVpcIpamPoolCidrsArgs.builder()
                .ipamPoolId(p.applyValue(getVpcIpamPoolResult -> getVpcIpamPoolResult.id()))
                .build());
    
        }
    }
    
    variables:
      c:
        fn::invoke:
          Function: aws:ec2:getVpcIpamPoolCidrs
          Arguments:
            ipamPoolId: ${p.id}
      p:
        fn::invoke:
          Function: aws:ec2:getVpcIpamPool
          Arguments:
            filters:
              - name: description
                values:
                  - '*mypool*'
              - name: address-family
                values:
                  - ipv4
    

    Filtering:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const c = aws.ec2.getVpcIpamPoolCidrs({
        ipamPoolId: "ipam-pool-123",
        filters: [{
            name: "cidr",
            values: ["10.*"],
        }],
    });
    const mycidrs = c.then(c => .filter(cidr => cidr.state == "provisioned").map(cidr => (cidr.cidr)));
    const pls = new aws.ec2.ManagedPrefixList("pls", {
        entries: mycidrs.map((v, k) => ({key: k, value: v})).then(entries => entries.map(entry => ({
            cidr: entry.value,
            description: entry.value,
        }))),
        name: `IPAM Pool (${test.id}) Cidrs`,
        addressFamily: "IPv4",
        maxEntries: mycidrs.length,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    c = aws.ec2.get_vpc_ipam_pool_cidrs(ipam_pool_id="ipam-pool-123",
        filters=[{
            "name": "cidr",
            "values": ["10.*"],
        }])
    mycidrs = [cidr.cidr for cidr in c.ipam_pool_cidrs if cidr.state == "provisioned"]
    pls = aws.ec2.ManagedPrefixList("pls",
        entries=[{
            "cidr": entry["value"],
            "description": entry["value"],
        } for entry in [{"key": k, "value": v} for k, v in mycidrs]],
        name=f"IPAM Pool ({test['id']}) Cidrs",
        address_family="IPv4",
        max_entries=len(mycidrs))
    
    Coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var c = Aws.Ec2.GetVpcIpamPoolCidrs.Invoke(new()
        {
            IpamPoolId = "ipam-pool-123",
            Filters = new[]
            {
                new Aws.Ec2.Inputs.GetVpcIpamPoolCidrsFilterInputArgs
                {
                    Name = "cidr",
                    Values = new[]
                    {
                        "10.*",
                    },
                },
            },
        });
    
        var mycidrs = .Where(cidr => cidr.State == "provisioned").Select(cidr => 
        {
            return cidr.Cidr;
        }).ToList();
    
        var pls = new Aws.Ec2.ManagedPrefixList("pls", new()
        {
            Entries = mycidrs.Select((v, k) => new { Key = k, Value = v }).Apply(entries => entries.Select(entry => 
            {
                return 
                {
                    { "cidr", entry.Value },
                    { "description", entry.Value },
                };
            }).ToList()),
            Name = $"IPAM Pool ({test.Id}) Cidrs",
            AddressFamily = "IPv4",
            MaxEntries = mycidrs.Length,
        });
    
    });
    
    Coming soon!
    
    Coming soon!
    

    Using getVpcIpamPoolCidrs

    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 getVpcIpamPoolCidrs(args: GetVpcIpamPoolCidrsArgs, opts?: InvokeOptions): Promise<GetVpcIpamPoolCidrsResult>
    function getVpcIpamPoolCidrsOutput(args: GetVpcIpamPoolCidrsOutputArgs, opts?: InvokeOptions): Output<GetVpcIpamPoolCidrsResult>
    def get_vpc_ipam_pool_cidrs(filters: Optional[Sequence[GetVpcIpamPoolCidrsFilter]] = None,
                                ipam_pool_id: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetVpcIpamPoolCidrsResult
    def get_vpc_ipam_pool_cidrs_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVpcIpamPoolCidrsFilterArgs]]]] = None,
                                ipam_pool_id: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetVpcIpamPoolCidrsResult]
    func GetVpcIpamPoolCidrs(ctx *Context, args *GetVpcIpamPoolCidrsArgs, opts ...InvokeOption) (*GetVpcIpamPoolCidrsResult, error)
    func GetVpcIpamPoolCidrsOutput(ctx *Context, args *GetVpcIpamPoolCidrsOutputArgs, opts ...InvokeOption) GetVpcIpamPoolCidrsResultOutput

    > Note: This function is named GetVpcIpamPoolCidrs in the Go SDK.

    public static class GetVpcIpamPoolCidrs 
    {
        public static Task<GetVpcIpamPoolCidrsResult> InvokeAsync(GetVpcIpamPoolCidrsArgs args, InvokeOptions? opts = null)
        public static Output<GetVpcIpamPoolCidrsResult> Invoke(GetVpcIpamPoolCidrsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVpcIpamPoolCidrsResult> getVpcIpamPoolCidrs(GetVpcIpamPoolCidrsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:ec2/getVpcIpamPoolCidrs:getVpcIpamPoolCidrs
      arguments:
        # arguments dictionary

    The following arguments are supported:

    IpamPoolId string
    ID of the IPAM pool you would like the list of provisioned CIDRs.
    Filters List<GetVpcIpamPoolCidrsFilter>
    Custom filter block as described below.
    IpamPoolId string
    ID of the IPAM pool you would like the list of provisioned CIDRs.
    Filters []GetVpcIpamPoolCidrsFilter
    Custom filter block as described below.
    ipamPoolId String
    ID of the IPAM pool you would like the list of provisioned CIDRs.
    filters List<GetVpcIpamPoolCidrsFilter>
    Custom filter block as described below.
    ipamPoolId string
    ID of the IPAM pool you would like the list of provisioned CIDRs.
    filters GetVpcIpamPoolCidrsFilter[]
    Custom filter block as described below.
    ipam_pool_id str
    ID of the IPAM pool you would like the list of provisioned CIDRs.
    filters Sequence[GetVpcIpamPoolCidrsFilter]
    Custom filter block as described below.
    ipamPoolId String
    ID of the IPAM pool you would like the list of provisioned CIDRs.
    filters List<Property Map>
    Custom filter block as described below.

    getVpcIpamPoolCidrs Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    IpamPoolCidrs List<GetVpcIpamPoolCidrsIpamPoolCidr>
    The CIDRs provisioned into the IPAM pool, described below.
    IpamPoolId string
    Filters List<GetVpcIpamPoolCidrsFilter>
    Id string
    The provider-assigned unique ID for this managed resource.
    IpamPoolCidrs []GetVpcIpamPoolCidrsIpamPoolCidr
    The CIDRs provisioned into the IPAM pool, described below.
    IpamPoolId string
    Filters []GetVpcIpamPoolCidrsFilter
    id String
    The provider-assigned unique ID for this managed resource.
    ipamPoolCidrs List<GetVpcIpamPoolCidrsIpamPoolCidr>
    The CIDRs provisioned into the IPAM pool, described below.
    ipamPoolId String
    filters List<GetVpcIpamPoolCidrsFilter>
    id string
    The provider-assigned unique ID for this managed resource.
    ipamPoolCidrs GetVpcIpamPoolCidrsIpamPoolCidr[]
    The CIDRs provisioned into the IPAM pool, described below.
    ipamPoolId string
    filters GetVpcIpamPoolCidrsFilter[]
    id str
    The provider-assigned unique ID for this managed resource.
    ipam_pool_cidrs Sequence[GetVpcIpamPoolCidrsIpamPoolCidr]
    The CIDRs provisioned into the IPAM pool, described below.
    ipam_pool_id str
    filters Sequence[GetVpcIpamPoolCidrsFilter]
    id String
    The provider-assigned unique ID for this managed resource.
    ipamPoolCidrs List<Property Map>
    The CIDRs provisioned into the IPAM pool, described below.
    ipamPoolId String
    filters List<Property Map>

    Supporting Types

    GetVpcIpamPoolCidrsFilter

    Name string
    Values List<string>
    Name string
    Values []string
    name String
    values List<String>
    name string
    values string[]
    name str
    values Sequence[str]
    name String
    values List<String>

    GetVpcIpamPoolCidrsIpamPoolCidr

    Cidr string
    A network CIDR.
    State string
    The provisioning state of that CIDR.
    Cidr string
    A network CIDR.
    State string
    The provisioning state of that CIDR.
    cidr String
    A network CIDR.
    state String
    The provisioning state of that CIDR.
    cidr string
    A network CIDR.
    state string
    The provisioning state of that CIDR.
    cidr str
    A network CIDR.
    state str
    The provisioning state of that CIDR.
    cidr String
    A network CIDR.
    state String
    The provisioning state of that CIDR.

    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