1. Packages
  2. Netaddr Provider
  3. API Docs
  4. getAddressIpv4V2
netaddr 0.6.0 published on Tuesday, Feb 3, 2026 by ferlab-ste-justine
netaddr logo
netaddr 0.6.0 published on Tuesday, Feb 3, 2026 by ferlab-ste-justine

    Retrieves data on an existing ipv4 address. Version 2 adds support for an ip address assigned from multiple ranges (useful if you get an extra range of ips from the same subnet later on).

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netaddr from "@pulumi/netaddr";
    
    const range1 = netaddr.getRangeIpv4({
        keyPrefix: "/test/ipv4/",
    });
    const range2 = netaddr.getRangeIpv4({
        keyPrefix: "/test/ipv4-extras/",
    });
    const test = Promise.all([range1, range2]).then(([range1, range2]) => netaddr.getAddressIpv4V2({
        rangeIds: [
            range1.id,
            range2.id,
        ],
        name: "test",
    }));
    export const dataIpv4Test = testNetaddrAddressIpv4.address;
    
    import pulumi
    import pulumi_netaddr as netaddr
    
    range1 = netaddr.get_range_ipv4(key_prefix="/test/ipv4/")
    range2 = netaddr.get_range_ipv4(key_prefix="/test/ipv4-extras/")
    test = netaddr.get_address_ipv4_v2(range_ids=[
            range1.id,
            range2.id,
        ],
        name="test")
    pulumi.export("dataIpv4Test", test_netaddr_address_ipv4["address"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netaddr/netaddr"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    range1, err := netaddr.LookupRangeIpv4(ctx, &netaddr.LookupRangeIpv4Args{
    KeyPrefix: "/test/ipv4/",
    }, nil);
    if err != nil {
    return err
    }
    range2, err := netaddr.LookupRangeIpv4(ctx, &netaddr.LookupRangeIpv4Args{
    KeyPrefix: "/test/ipv4-extras/",
    }, nil);
    if err != nil {
    return err
    }
    _, err = netaddr.LookupAddressIpv4V2(ctx, &netaddr.LookupAddressIpv4V2Args{
    RangeIds: interface{}{
    range1.Id,
    range2.Id,
    },
    Name: "test",
    }, nil);
    if err != nil {
    return err
    }
    ctx.Export("dataIpv4Test", testNetaddrAddressIpv4.Address)
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Netaddr = Pulumi.Netaddr;
    
    return await Deployment.RunAsync(() => 
    {
        var range1 = Netaddr.GetRangeIpv4.Invoke(new()
        {
            KeyPrefix = "/test/ipv4/",
        });
    
        var range2 = Netaddr.GetRangeIpv4.Invoke(new()
        {
            KeyPrefix = "/test/ipv4-extras/",
        });
    
        var test = Netaddr.GetAddressIpv4V2.Invoke(new()
        {
            RangeIds = new[]
            {
                range1.Apply(getRangeIpv4Result => getRangeIpv4Result.Id),
                range2.Apply(getRangeIpv4Result => getRangeIpv4Result.Id),
            },
            Name = "test",
        });
    
        return new Dictionary<string, object?>
        {
            ["dataIpv4Test"] = testNetaddrAddressIpv4.Address,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netaddr.NetaddrFunctions;
    import com.pulumi.netaddr.inputs.GetRangeIpv4Args;
    import com.pulumi.netaddr.inputs.GetAddressIpv4V2Args;
    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 range1 = NetaddrFunctions.getRangeIpv4(GetRangeIpv4Args.builder()
                .keyPrefix("/test/ipv4/")
                .build());
    
            final var range2 = NetaddrFunctions.getRangeIpv4(GetRangeIpv4Args.builder()
                .keyPrefix("/test/ipv4-extras/")
                .build());
    
            final var test = NetaddrFunctions.getAddressIpv4V2(GetAddressIpv4V2Args.builder()
                .rangeIds(            
                    range1.id(),
                    range2.id())
                .name("test")
                .build());
    
            ctx.export("dataIpv4Test", testNetaddrAddressIpv4.address());
        }
    }
    
    variables:
      range1:
        fn::invoke:
          function: netaddr:getRangeIpv4
          arguments:
            keyPrefix: /test/ipv4/
      range2:
        fn::invoke:
          function: netaddr:getRangeIpv4
          arguments:
            keyPrefix: /test/ipv4-extras/
      test:
        fn::invoke:
          function: netaddr:getAddressIpv4V2
          arguments:
            rangeIds:
              - ${range1.id}
              - ${range2.id}
            name: test
    outputs:
      dataIpv4Test: ${testNetaddrAddressIpv4.address}
    

    Using getAddressIpv4V2

    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 getAddressIpv4V2(args: GetAddressIpv4V2Args, opts?: InvokeOptions): Promise<GetAddressIpv4V2Result>
    function getAddressIpv4V2Output(args: GetAddressIpv4V2OutputArgs, opts?: InvokeOptions): Output<GetAddressIpv4V2Result>
    def get_address_ipv4_v2(id: Optional[str] = None,
                            name: Optional[str] = None,
                            range_ids: Optional[Sequence[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> GetAddressIpv4V2Result
    def get_address_ipv4_v2_output(id: Optional[pulumi.Input[str]] = None,
                            name: Optional[pulumi.Input[str]] = None,
                            range_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetAddressIpv4V2Result]
    func LookupAddressIpv4V2(ctx *Context, args *LookupAddressIpv4V2Args, opts ...InvokeOption) (*LookupAddressIpv4V2Result, error)
    func LookupAddressIpv4V2Output(ctx *Context, args *LookupAddressIpv4V2OutputArgs, opts ...InvokeOption) LookupAddressIpv4V2ResultOutput

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

    public static class GetAddressIpv4V2 
    {
        public static Task<GetAddressIpv4V2Result> InvokeAsync(GetAddressIpv4V2Args args, InvokeOptions? opts = null)
        public static Output<GetAddressIpv4V2Result> Invoke(GetAddressIpv4V2InvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAddressIpv4V2Result> getAddressIpv4V2(GetAddressIpv4V2Args args, InvokeOptions options)
    public static Output<GetAddressIpv4V2Result> getAddressIpv4V2(GetAddressIpv4V2Args args, InvokeOptions options)
    
    fn::invoke:
      function: netaddr:index/getAddressIpv4V2:getAddressIpv4V2
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the address.
    RangeIds List<string>
    Identifiers of the address ranges the address is tied to.
    Id string
    The ID of this resource.
    Name string
    Name of the address.
    RangeIds []string
    Identifiers of the address ranges the address is tied to.
    Id string
    The ID of this resource.
    name String
    Name of the address.
    rangeIds List<String>
    Identifiers of the address ranges the address is tied to.
    id String
    The ID of this resource.
    name string
    Name of the address.
    rangeIds string[]
    Identifiers of the address ranges the address is tied to.
    id string
    The ID of this resource.
    name str
    Name of the address.
    range_ids Sequence[str]
    Identifiers of the address ranges the address is tied to.
    id str
    The ID of this resource.
    name String
    Name of the address.
    rangeIds List<String>
    Identifiers of the address ranges the address is tied to.
    id String
    The ID of this resource.

    getAddressIpv4V2 Result

    The following output properties are available:

    Address string
    The address that got assigned to the resource.
    FoundInRange string
    Id of the range the address is in.
    Id string
    The ID of this resource.
    Name string
    Name of the address.
    RangeIds List<string>
    Identifiers of the address ranges the address is tied to.
    Address string
    The address that got assigned to the resource.
    FoundInRange string
    Id of the range the address is in.
    Id string
    The ID of this resource.
    Name string
    Name of the address.
    RangeIds []string
    Identifiers of the address ranges the address is tied to.
    address String
    The address that got assigned to the resource.
    foundInRange String
    Id of the range the address is in.
    id String
    The ID of this resource.
    name String
    Name of the address.
    rangeIds List<String>
    Identifiers of the address ranges the address is tied to.
    address string
    The address that got assigned to the resource.
    foundInRange string
    Id of the range the address is in.
    id string
    The ID of this resource.
    name string
    Name of the address.
    rangeIds string[]
    Identifiers of the address ranges the address is tied to.
    address str
    The address that got assigned to the resource.
    found_in_range str
    Id of the range the address is in.
    id str
    The ID of this resource.
    name str
    Name of the address.
    range_ids Sequence[str]
    Identifiers of the address ranges the address is tied to.
    address String
    The address that got assigned to the resource.
    foundInRange String
    Id of the range the address is in.
    id String
    The ID of this resource.
    name String
    Name of the address.
    rangeIds List<String>
    Identifiers of the address ranges the address is tied to.

    Package Details

    Repository
    netaddr ferlab-ste-justine/terraform-provider-netaddr
    License
    Notes
    This Pulumi package is based on the netaddr Terraform Provider.
    netaddr logo
    netaddr 0.6.0 published on Tuesday, Feb 3, 2026 by ferlab-ste-justine
      Meet Neo: Your AI Platform Teammate