1. Packages
  2. Netaddr Provider
  3. API Docs
  4. AddressIpv4
netaddr 0.5.1 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine

netaddr.AddressIpv4

Explore with Pulumi AI

Ipv4 address.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as netaddr from "@pulumi/netaddr";

const testRangeIpv4 = new netaddr.RangeIpv4("testRangeIpv4", {
    keyPrefix: "/test/ipv4/",
    firstAddress: "192.168.0.1",
    lastAddress: "192.168.0.254",
});
const testAddressIpv4 = new netaddr.AddressIpv4("testAddressIpv4", {
    rangeId: testRangeIpv4.rangeIpv4Id,
    hardcodedAddress: "192.168.0.5",
});
const test2 = new netaddr.AddressIpv4("test2", {rangeId: testRangeIpv4.rangeIpv4Id});
export const testAddr = testAddressIpv4.address;
export const test2Addr = test2.address;
Copy
import pulumi
import pulumi_netaddr as netaddr

test_range_ipv4 = netaddr.RangeIpv4("testRangeIpv4",
    key_prefix="/test/ipv4/",
    first_address="192.168.0.1",
    last_address="192.168.0.254")
test_address_ipv4 = netaddr.AddressIpv4("testAddressIpv4",
    range_id=test_range_ipv4.range_ipv4_id,
    hardcoded_address="192.168.0.5")
test2 = netaddr.AddressIpv4("test2", range_id=test_range_ipv4.range_ipv4_id)
pulumi.export("testAddr", test_address_ipv4.address)
pulumi.export("test2Addr", test2.address)
Copy
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 {
		testRangeIpv4, err := netaddr.NewRangeIpv4(ctx, "testRangeIpv4", &netaddr.RangeIpv4Args{
			KeyPrefix:    pulumi.String("/test/ipv4/"),
			FirstAddress: pulumi.String("192.168.0.1"),
			LastAddress:  pulumi.String("192.168.0.254"),
		})
		if err != nil {
			return err
		}
		testAddressIpv4, err := netaddr.NewAddressIpv4(ctx, "testAddressIpv4", &netaddr.AddressIpv4Args{
			RangeId:          testRangeIpv4.RangeIpv4Id,
			HardcodedAddress: pulumi.String("192.168.0.5"),
		})
		if err != nil {
			return err
		}
		test2, err := netaddr.NewAddressIpv4(ctx, "test2", &netaddr.AddressIpv4Args{
			RangeId: testRangeIpv4.RangeIpv4Id,
		})
		if err != nil {
			return err
		}
		ctx.Export("testAddr", testAddressIpv4.Address)
		ctx.Export("test2Addr", test2.Address)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netaddr = Pulumi.Netaddr;

return await Deployment.RunAsync(() => 
{
    var testRangeIpv4 = new Netaddr.RangeIpv4("testRangeIpv4", new()
    {
        KeyPrefix = "/test/ipv4/",
        FirstAddress = "192.168.0.1",
        LastAddress = "192.168.0.254",
    });

    var testAddressIpv4 = new Netaddr.AddressIpv4("testAddressIpv4", new()
    {
        RangeId = testRangeIpv4.RangeIpv4Id,
        HardcodedAddress = "192.168.0.5",
    });

    var test2 = new Netaddr.AddressIpv4("test2", new()
    {
        RangeId = testRangeIpv4.RangeIpv4Id,
    });

    return new Dictionary<string, object?>
    {
        ["testAddr"] = testAddressIpv4.Address,
        ["test2Addr"] = test2.Address,
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netaddr.RangeIpv4;
import com.pulumi.netaddr.RangeIpv4Args;
import com.pulumi.netaddr.AddressIpv4;
import com.pulumi.netaddr.AddressIpv4Args;
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) {
        var testRangeIpv4 = new RangeIpv4("testRangeIpv4", RangeIpv4Args.builder()
            .keyPrefix("/test/ipv4/")
            .firstAddress("192.168.0.1")
            .lastAddress("192.168.0.254")
            .build());

        var testAddressIpv4 = new AddressIpv4("testAddressIpv4", AddressIpv4Args.builder()
            .rangeId(testRangeIpv4.rangeIpv4Id())
            .hardcodedAddress("192.168.0.5")
            .build());

        var test2 = new AddressIpv4("test2", AddressIpv4Args.builder()
            .rangeId(testRangeIpv4.rangeIpv4Id())
            .build());

        ctx.export("testAddr", testAddressIpv4.address());
        ctx.export("test2Addr", test2.address());
    }
}
Copy
resources:
  testRangeIpv4:
    type: netaddr:RangeIpv4
    properties:
      keyPrefix: /test/ipv4/
      firstAddress: 192.168.0.1
      lastAddress: 192.168.0.254
  testAddressIpv4:
    type: netaddr:AddressIpv4
    properties:
      rangeId: ${testRangeIpv4.rangeIpv4Id}
      hardcodedAddress: 192.168.0.5
  test2:
    type: netaddr:AddressIpv4
    properties:
      rangeId: ${testRangeIpv4.rangeIpv4Id}
outputs:
  testAddr: ${testAddressIpv4.address}
  test2Addr: ${test2.address}
Copy

Create AddressIpv4 Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new AddressIpv4(name: string, args: AddressIpv4Args, opts?: CustomResourceOptions);
@overload
def AddressIpv4(resource_name: str,
                args: AddressIpv4Args,
                opts: Optional[ResourceOptions] = None)

@overload
def AddressIpv4(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                range_id: Optional[str] = None,
                address_ipv4_id: Optional[str] = None,
                hardcoded_address: Optional[str] = None,
                name: Optional[str] = None)
func NewAddressIpv4(ctx *Context, name string, args AddressIpv4Args, opts ...ResourceOption) (*AddressIpv4, error)
public AddressIpv4(string name, AddressIpv4Args args, CustomResourceOptions? opts = null)
public AddressIpv4(String name, AddressIpv4Args args)
public AddressIpv4(String name, AddressIpv4Args args, CustomResourceOptions options)
type: netaddr:AddressIpv4
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AddressIpv4Args
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AddressIpv4Args
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AddressIpv4Args
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AddressIpv4Args
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AddressIpv4Args
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var addressIpv4Resource = new Netaddr.AddressIpv4("addressIpv4Resource", new()
{
    RangeId = "string",
    AddressIpv4Id = "string",
    HardcodedAddress = "string",
    Name = "string",
});
Copy
example, err := netaddr.NewAddressIpv4(ctx, "addressIpv4Resource", &netaddr.AddressIpv4Args{
	RangeId:          pulumi.String("string"),
	AddressIpv4Id:    pulumi.String("string"),
	HardcodedAddress: pulumi.String("string"),
	Name:             pulumi.String("string"),
})
Copy
var addressIpv4Resource = new AddressIpv4("addressIpv4Resource", AddressIpv4Args.builder()
    .rangeId("string")
    .addressIpv4Id("string")
    .hardcodedAddress("string")
    .name("string")
    .build());
Copy
address_ipv4_resource = netaddr.AddressIpv4("addressIpv4Resource",
    range_id="string",
    address_ipv4_id="string",
    hardcoded_address="string",
    name="string")
Copy
const addressIpv4Resource = new netaddr.AddressIpv4("addressIpv4Resource", {
    rangeId: "string",
    addressIpv4Id: "string",
    hardcodedAddress: "string",
    name: "string",
});
Copy
type: netaddr:AddressIpv4
properties:
    addressIpv4Id: string
    hardcodedAddress: string
    name: string
    rangeId: string
Copy

AddressIpv4 Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The AddressIpv4 resource accepts the following input properties:

RangeId This property is required. string
Identifier of the address range the address is tied to.
AddressIpv4Id string
The ID of this resource.
HardcodedAddress string
An optional input to fixate the address to a specific value.
Name string
Name to associate with the address.
RangeId This property is required. string
Identifier of the address range the address is tied to.
AddressIpv4Id string
The ID of this resource.
HardcodedAddress string
An optional input to fixate the address to a specific value.
Name string
Name to associate with the address.
rangeId This property is required. String
Identifier of the address range the address is tied to.
addressIpv4Id String
The ID of this resource.
hardcodedAddress String
An optional input to fixate the address to a specific value.
name String
Name to associate with the address.
rangeId This property is required. string
Identifier of the address range the address is tied to.
addressIpv4Id string
The ID of this resource.
hardcodedAddress string
An optional input to fixate the address to a specific value.
name string
Name to associate with the address.
range_id This property is required. str
Identifier of the address range the address is tied to.
address_ipv4_id str
The ID of this resource.
hardcoded_address str
An optional input to fixate the address to a specific value.
name str
Name to associate with the address.
rangeId This property is required. String
Identifier of the address range the address is tied to.
addressIpv4Id String
The ID of this resource.
hardcodedAddress String
An optional input to fixate the address to a specific value.
name String
Name to associate with the address.

Outputs

All input properties are implicitly available as output properties. Additionally, the AddressIpv4 resource produces the following output properties:

Address string
The address that got assigned to the resource.
Id string
The provider-assigned unique ID for this managed resource.
Address string
The address that got assigned to the resource.
Id string
The provider-assigned unique ID for this managed resource.
address String
The address that got assigned to the resource.
id String
The provider-assigned unique ID for this managed resource.
address string
The address that got assigned to the resource.
id string
The provider-assigned unique ID for this managed resource.
address str
The address that got assigned to the resource.
id str
The provider-assigned unique ID for this managed resource.
address String
The address that got assigned to the resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing AddressIpv4 Resource

Get an existing AddressIpv4 resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AddressIpv4State, opts?: CustomResourceOptions): AddressIpv4
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        address: Optional[str] = None,
        address_ipv4_id: Optional[str] = None,
        hardcoded_address: Optional[str] = None,
        name: Optional[str] = None,
        range_id: Optional[str] = None) -> AddressIpv4
func GetAddressIpv4(ctx *Context, name string, id IDInput, state *AddressIpv4State, opts ...ResourceOption) (*AddressIpv4, error)
public static AddressIpv4 Get(string name, Input<string> id, AddressIpv4State? state, CustomResourceOptions? opts = null)
public static AddressIpv4 get(String name, Output<String> id, AddressIpv4State state, CustomResourceOptions options)
resources:  _:    type: netaddr:AddressIpv4    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Address string
The address that got assigned to the resource.
AddressIpv4Id string
The ID of this resource.
HardcodedAddress string
An optional input to fixate the address to a specific value.
Name string
Name to associate with the address.
RangeId string
Identifier of the address range the address is tied to.
Address string
The address that got assigned to the resource.
AddressIpv4Id string
The ID of this resource.
HardcodedAddress string
An optional input to fixate the address to a specific value.
Name string
Name to associate with the address.
RangeId string
Identifier of the address range the address is tied to.
address String
The address that got assigned to the resource.
addressIpv4Id String
The ID of this resource.
hardcodedAddress String
An optional input to fixate the address to a specific value.
name String
Name to associate with the address.
rangeId String
Identifier of the address range the address is tied to.
address string
The address that got assigned to the resource.
addressIpv4Id string
The ID of this resource.
hardcodedAddress string
An optional input to fixate the address to a specific value.
name string
Name to associate with the address.
rangeId string
Identifier of the address range the address is tied to.
address str
The address that got assigned to the resource.
address_ipv4_id str
The ID of this resource.
hardcoded_address str
An optional input to fixate the address to a specific value.
name str
Name to associate with the address.
range_id str
Identifier of the address range the address is tied to.
address String
The address that got assigned to the resource.
addressIpv4Id String
The ID of this resource.
hardcodedAddress String
An optional input to fixate the address to a specific value.
name String
Name to associate with the address.
rangeId String
Identifier of the address range 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.