AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi
aws.ec2.getVpcIpamPoolCidrs
Explore with Pulumi AI
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:
- Ipam
Pool stringId - ID of the IPAM pool you would like the list of provisioned CIDRs.
- Filters
List<Get
Vpc Ipam Pool Cidrs Filter> - Custom filter block as described below.
- Ipam
Pool stringId - ID of the IPAM pool you would like the list of provisioned CIDRs.
- Filters
[]Get
Vpc Ipam Pool Cidrs Filter - Custom filter block as described below.
- ipam
Pool StringId - ID of the IPAM pool you would like the list of provisioned CIDRs.
- filters
List<Get
Vpc Ipam Pool Cidrs Filter> - Custom filter block as described below.
- ipam
Pool stringId - ID of the IPAM pool you would like the list of provisioned CIDRs.
- filters
Get
Vpc Ipam Pool Cidrs Filter[] - Custom filter block as described below.
- ipam_
pool_ strid - ID of the IPAM pool you would like the list of provisioned CIDRs.
- filters
Sequence[Get
Vpc Ipam Pool Cidrs Filter] - Custom filter block as described below.
- ipam
Pool StringId - 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.
- Ipam
Pool List<GetCidrs Vpc Ipam Pool Cidrs Ipam Pool Cidr> - The CIDRs provisioned into the IPAM pool, described below.
- Ipam
Pool stringId - Filters
List<Get
Vpc Ipam Pool Cidrs Filter>
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipam
Pool []GetCidrs Vpc Ipam Pool Cidrs Ipam Pool Cidr - The CIDRs provisioned into the IPAM pool, described below.
- Ipam
Pool stringId - Filters
[]Get
Vpc Ipam Pool Cidrs Filter
- id String
- The provider-assigned unique ID for this managed resource.
- ipam
Pool List<GetCidrs Vpc Ipam Pool Cidrs Ipam Pool Cidr> - The CIDRs provisioned into the IPAM pool, described below.
- ipam
Pool StringId - filters
List<Get
Vpc Ipam Pool Cidrs Filter>
- id string
- The provider-assigned unique ID for this managed resource.
- ipam
Pool GetCidrs Vpc Ipam Pool Cidrs Ipam Pool Cidr[] - The CIDRs provisioned into the IPAM pool, described below.
- ipam
Pool stringId - filters
Get
Vpc Ipam Pool Cidrs Filter[]
- id str
- The provider-assigned unique ID for this managed resource.
- ipam_
pool_ Sequence[Getcidrs Vpc Ipam Pool Cidrs Ipam Pool Cidr] - The CIDRs provisioned into the IPAM pool, described below.
- ipam_
pool_ strid - filters
Sequence[Get
Vpc Ipam Pool Cidrs Filter]
- id String
- The provider-assigned unique ID for this managed resource.
- ipam
Pool List<Property Map>Cidrs - The CIDRs provisioned into the IPAM pool, described below.
- ipam
Pool StringId - filters List<Property Map>
Supporting Types
GetVpcIpamPoolCidrsFilter
GetVpcIpamPoolCidrsIpamPoolCidr
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.