@equinix-labs/pulumi-equinix
Version:
A Pulumi package for creating and managing equinix cloud resources.
166 lines • 8.43 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReservedIpBlock = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource to create and manage blocks of reserved IP addresses in a project.
*
* When a user provisions first device in a metro, Equinix Metal API automatically allocates IPv6/56 and private IPv4/25 blocks. The new device then gets IPv6 and private IPv4 addresses from those block. It also gets a public IPv4/31 address. Every new device in the project and metro will automatically get IPv6 and private IPv4 addresses from these pre-allocated blocks. The IPv6 and private IPv4 blocks can't be created, only imported. With this resource, it's possible to create either public IPv4 blocks or global IPv4 blocks.
*
* Public blocks are allocated in a metro. Addresses from public blocks can only be assigned to devices in the metro. Public blocks can have mask from /24 (256 addresses) to /32 (1 address). If you create public block with this resource, you must fill the metro argument.
*
* Addresses from global blocks can be assigned in any metro. Global blocks can have mask from /30 (4 addresses), to /32 (1 address). If you create global block with this resource, you must specify type = "globalIpv4" and you must omit the metro argument.
*
* Once IP block is allocated or imported, an address from it can be assigned to device with the `equinix.metal.IpAttachment` resource.
*
* See the [Virtual Routing and Forwarding documentation](https://deploy.equinix.com/developers/docs/metal/layer2-networking/vrf/) for product details and API reference material.
*
* ## Example Usage
* ### example 1
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as equinix from "@equinix-labs/pulumi-equinix";
*
* const twoElasticAddresses = new equinix.metal.ReservedIpBlock("twoElasticAddresses", {
* projectId: projectId,
* metro: "sv",
* quantity: 2,
* });
* const test1 = new equinix.metal.ReservedIpBlock("test1", {
* projectId: projectId,
* type: equinix.metal.IpBlockType.PublicIPv4,
* metro: "sv",
* quantity: 1,
* });
* const test = new equinix.metal.ReservedIpBlock("test", {
* projectId: projectId,
* type: equinix.metal.IpBlockType.GlobalIPv4,
* quantity: 1,
* });
* ```
* ### example 2
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as equinix from "@equinix-labs/pulumi-equinix";
*
* const example = new equinix.metal.ReservedIpBlock("example", {
* projectId: projectId,
* metro: "sv",
* quantity: 2,
* });
* const nodes = new equinix.metal.Device("nodes", {
* projectId: projectId,
* metro: "sv",
* plan: equinix.metal.Plan.C3SmallX86,
* operatingSystem: equinix.metal.OperatingSystem.Ubuntu20_04,
* hostname: "test",
* billingCycle: equinix.metal.BillingCycle.Hourly,
* ipAddresses: [
* {
* type: "public_ipv4",
* cidr: 31,
* reservationIds: [example.id],
* },
* {
* type: "private_ipv4",
* },
* ],
* });
* ```
*
* ## Import
*
* This resource can be imported using an existing IP reservation ID:
*
* ```sh
* $ pulumi import equinix:metal/reservedIpBlock:ReservedIpBlock equinix_metal_reserved_ip_block {existing_ip_reservation_id}
* ```
*/
class ReservedIpBlock extends pulumi.CustomResource {
/**
* Get an existing ReservedIpBlock 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, id, state, opts) {
return new ReservedIpBlock(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ReservedIpBlock. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === ReservedIpBlock.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["address"] = state ? state.address : undefined;
resourceInputs["addressFamily"] = state ? state.addressFamily : undefined;
resourceInputs["cidr"] = state ? state.cidr : undefined;
resourceInputs["cidrNotation"] = state ? state.cidrNotation : undefined;
resourceInputs["customData"] = state ? state.customData : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["facility"] = state ? state.facility : undefined;
resourceInputs["gateway"] = state ? state.gateway : undefined;
resourceInputs["global"] = state ? state.global : undefined;
resourceInputs["manageable"] = state ? state.manageable : undefined;
resourceInputs["management"] = state ? state.management : undefined;
resourceInputs["metro"] = state ? state.metro : undefined;
resourceInputs["netmask"] = state ? state.netmask : undefined;
resourceInputs["network"] = state ? state.network : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["public"] = state ? state.public : undefined;
resourceInputs["quantity"] = state ? state.quantity : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["vrfId"] = state ? state.vrfId : undefined;
resourceInputs["waitForState"] = state ? state.waitForState : undefined;
}
else {
const args = argsOrState;
if ((!args || args.projectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
resourceInputs["cidr"] = args ? args.cidr : undefined;
resourceInputs["customData"] = args ? args.customData : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["facility"] = args ? args.facility : undefined;
resourceInputs["metro"] = args ? args.metro : undefined;
resourceInputs["network"] = args ? args.network : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["quantity"] = args ? args.quantity : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["vrfId"] = args ? args.vrfId : undefined;
resourceInputs["waitForState"] = args ? args.waitForState : undefined;
resourceInputs["address"] = undefined /*out*/;
resourceInputs["addressFamily"] = undefined /*out*/;
resourceInputs["cidrNotation"] = undefined /*out*/;
resourceInputs["gateway"] = undefined /*out*/;
resourceInputs["global"] = undefined /*out*/;
resourceInputs["manageable"] = undefined /*out*/;
resourceInputs["management"] = undefined /*out*/;
resourceInputs["netmask"] = undefined /*out*/;
resourceInputs["public"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ReservedIpBlock.__pulumiType, name, resourceInputs, opts);
}
}
exports.ReservedIpBlock = ReservedIpBlock;
/** @internal */
ReservedIpBlock.__pulumiType = 'equinix:metal/reservedIpBlock:ReservedIpBlock';
//# sourceMappingURL=reservedIpBlock.js.map