@natzka-oss/pulumi-netbox
Version:
A Pulumi package for creating and managing Netbox cloud resources.
250 lines (249 loc) • 9.42 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* From the [official documentation](https://docs.netbox.dev/en/stable/features/ipam/#ip-addresses):
*
* > An IP address comprises a single host address (either IPv4 or IPv6) and its subnet mask. Its mask should match exactly how the IP address is configured on an interface in the real world.
* >
* > Like a prefix, an IP address can optionally be assigned to a VRF (otherwise, it will appear in the "global" table). IP addresses are automatically arranged under parent prefixes within their respective VRFs according to the IP hierarchy.
*
* ## Example Usage
*
* ### Creating an IP address that is assigned to a virtual machine interface
*
* Starting with provider version 3.5.0, you can use the `virtualMachineInterfaceId` attribute to assign an IP address to a virtual machine interface.
* You can also use the `interfaceId` and `objectType` attributes instead.
*
* With `virtualMachineInterfaceId`:
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* // Assuming a virtual machine with the id `123` exists
* const _this = new netbox.virt.Interface("this", {
* name: "eth0",
* virtualMachineId: 123,
* });
* const thisIpAddress = new netbox.ipam.IpAddress("this", {
* ipAddress: "10.0.0.60/24",
* status: "active",
* virtualMachineInterfaceId: _this.id,
* });
* ```
*
* With `objectType` and `interfaceId`:
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* // Assuming a virtual machine with the id `123` exists
* const _this = new netbox.virt.Interface("this", {
* name: "eth0",
* virtualMachineId: 123,
* });
* const thisIpAddress = new netbox.ipam.IpAddress("this", {
* ipAddress: "10.0.0.60/24",
* status: "active",
* interfaceId: _this.id,
* objectType: "virtualization.vminterface",
* });
* ```
*
* ### Creating an IP address that is assigned to a device interface
*
* Starting with provider version 3.5.0, you can use the `deviceInterfaceId` attribute to assign an IP address to a device interface.
* You can also use the `interfaceId` and `objectType` attributes instead.
*
* With `deviceInterfaceId`:
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* // Assuming a device with the id `123` exists
* const _this = new netbox.dcim.DeviceInterface("this", {
* name: "eth0",
* deviceId: 123,
* type: "1000base-t",
* });
* const thisIpAddress = new netbox.ipam.IpAddress("this", {
* ipAddress: "10.0.0.60/24",
* status: "active",
* deviceInterfaceId: _this.id,
* });
* ```
*
* With `objectType` and `interfaceId`:
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* // Assuming a device with the id `123` exists
* const _this = new netbox.dcim.DeviceInterface("this", {
* name: "eth0",
* deviceId: 123,
* type: "1000base-t",
* });
* const thisIpAddress = new netbox.ipam.IpAddress("this", {
* ipAddress: "10.0.0.60/24",
* status: "active",
* interfaceId: _this.id,
* objectType: "dcim.interface",
* });
* ```
*
* ### Creating an IP address that is not assigned to anything
*
* You can create an IP address that is not assigned to anything by omitting the attributes mentioned above.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as netbox from "@natzka-oss/pulumi-netbox";
*
* const _this = new netbox.ipam.IpAddress("this", {
* ipAddress: "10.0.0.50/24",
* status: "reserved",
* });
* ```
*/
export declare class IpAddress extends pulumi.CustomResource {
/**
* Get an existing IpAddress resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: IpAddressState, opts?: pulumi.CustomResourceOptions): IpAddress;
/**
* Returns true if the given object is an instance of IpAddress. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is IpAddress;
readonly customFields: pulumi.Output<{
[key: string]: string;
} | undefined>;
readonly description: pulumi.Output<string | undefined>;
/**
* Conflicts with `interfaceId` and `virtualMachineInterfaceId`.
*/
readonly deviceInterfaceId: pulumi.Output<number | undefined>;
readonly dnsName: pulumi.Output<string | undefined>;
/**
* Required when `objectType` is set.
*/
readonly interfaceId: pulumi.Output<number | undefined>;
readonly ipAddress: pulumi.Output<string>;
readonly natInsideAddressId: pulumi.Output<number | undefined>;
readonly natOutsideAddresses: pulumi.Output<outputs.ipam.IpAddressNatOutsideAddress[]>;
/**
* Valid values are `virtualization.vminterface` and `dcim.interface`. Required when `interfaceId` is set.
*/
readonly objectType: pulumi.Output<string | undefined>;
/**
* Valid values are `loopback`, `secondary`, `anycast`, `vip`, `vrrp`, `hsrp`, `glbp` and `carp`.
*/
readonly role: pulumi.Output<string | undefined>;
/**
* Valid values are `active`, `reserved`, `deprecated`, `dhcp` and `slaac`.
*/
readonly status: pulumi.Output<string>;
readonly tags: pulumi.Output<string[] | undefined>;
readonly tagsAlls: pulumi.Output<string[]>;
readonly tenantId: pulumi.Output<number | undefined>;
/**
* Conflicts with `interfaceId` and `deviceInterfaceId`.
*/
readonly virtualMachineInterfaceId: pulumi.Output<number | undefined>;
readonly vrfId: pulumi.Output<number | undefined>;
/**
* Create a IpAddress resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: IpAddressArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering IpAddress resources.
*/
export interface IpAddressState {
customFields?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
description?: pulumi.Input<string>;
/**
* Conflicts with `interfaceId` and `virtualMachineInterfaceId`.
*/
deviceInterfaceId?: pulumi.Input<number>;
dnsName?: pulumi.Input<string>;
/**
* Required when `objectType` is set.
*/
interfaceId?: pulumi.Input<number>;
ipAddress?: pulumi.Input<string>;
natInsideAddressId?: pulumi.Input<number>;
natOutsideAddresses?: pulumi.Input<pulumi.Input<inputs.ipam.IpAddressNatOutsideAddress>[]>;
/**
* Valid values are `virtualization.vminterface` and `dcim.interface`. Required when `interfaceId` is set.
*/
objectType?: pulumi.Input<string>;
/**
* Valid values are `loopback`, `secondary`, `anycast`, `vip`, `vrrp`, `hsrp`, `glbp` and `carp`.
*/
role?: pulumi.Input<string>;
/**
* Valid values are `active`, `reserved`, `deprecated`, `dhcp` and `slaac`.
*/
status?: pulumi.Input<string>;
tags?: pulumi.Input<pulumi.Input<string>[]>;
tagsAlls?: pulumi.Input<pulumi.Input<string>[]>;
tenantId?: pulumi.Input<number>;
/**
* Conflicts with `interfaceId` and `deviceInterfaceId`.
*/
virtualMachineInterfaceId?: pulumi.Input<number>;
vrfId?: pulumi.Input<number>;
}
/**
* The set of arguments for constructing a IpAddress resource.
*/
export interface IpAddressArgs {
customFields?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
description?: pulumi.Input<string>;
/**
* Conflicts with `interfaceId` and `virtualMachineInterfaceId`.
*/
deviceInterfaceId?: pulumi.Input<number>;
dnsName?: pulumi.Input<string>;
/**
* Required when `objectType` is set.
*/
interfaceId?: pulumi.Input<number>;
ipAddress: pulumi.Input<string>;
natInsideAddressId?: pulumi.Input<number>;
/**
* Valid values are `virtualization.vminterface` and `dcim.interface`. Required when `interfaceId` is set.
*/
objectType?: pulumi.Input<string>;
/**
* Valid values are `loopback`, `secondary`, `anycast`, `vip`, `vrrp`, `hsrp`, `glbp` and `carp`.
*/
role?: pulumi.Input<string>;
/**
* Valid values are `active`, `reserved`, `deprecated`, `dhcp` and `slaac`.
*/
status: pulumi.Input<string>;
tags?: pulumi.Input<pulumi.Input<string>[]>;
tenantId?: pulumi.Input<number>;
/**
* Conflicts with `interfaceId` and `deviceInterfaceId`.
*/
virtualMachineInterfaceId?: pulumi.Input<number>;
vrfId?: pulumi.Input<number>;
}