UNPKG

@equinix-labs/pulumi-equinix

Version:

A Pulumi package for creating and managing equinix cloud resources.

114 lines 5.6 kB
"use strict"; // *** 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.IpAttachment = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to attach elastic IP subnets to devices. * * To attach an IP subnet from a reserved block to a provisioned device, you must derive a subnet CIDR belonging to one of your reserved blocks in the same project and metro as the target device. * * For example, you have reserved IPv4 address block `147.229.10.152/30`, you can choose to assign either the whole block as one subnet to a device; or 2 subnets with CIDRs `147.229.10.152/31` and `147.229.10.154/31`; or 4 subnets with mask prefix length `32`. More about the elastic IP subnets is [here](https://metal.equinix.com/developers/docs/networking/elastic-ips/). * * Device and reserved block must be in the same metro. * * ## Example Usage * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as equinix from "@equinix-labs/pulumi-equinix"; * import * as std from "@pulumi/std"; * * const myblock = new equinix.metal.ReservedIpBlock("myblock", { * projectId: projectId, * metro: "ny", * quantity: 2, * }); * const firstAddressAssignment = new equinix.metal.IpAttachment("firstAddressAssignment", { * deviceId: mydevice.id, * cidrNotation: std.joinOutput({ * separator: "/", * input: [ * std.cidrhostOutput({ * input: myblockMetalReservedIpBlock.cidrNotation, * host: 0, * }).apply(invoke => invoke.result), * "32", * ], * }).apply(invoke => invoke.result), * }); * ``` */ class IpAttachment extends pulumi.CustomResource { /** * Get an existing IpAttachment 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 IpAttachment(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of IpAttachment. 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'] === IpAttachment.__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["deviceId"] = state ? state.deviceId : 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["netmask"] = state ? state.netmask : undefined; resourceInputs["network"] = state ? state.network : undefined; resourceInputs["public"] = state ? state.public : undefined; resourceInputs["vrfId"] = state ? state.vrfId : undefined; } else { const args = argsOrState; if ((!args || args.cidrNotation === undefined) && !opts.urn) { throw new Error("Missing required property 'cidrNotation'"); } if ((!args || args.deviceId === undefined) && !opts.urn) { throw new Error("Missing required property 'deviceId'"); } resourceInputs["cidrNotation"] = args ? args.cidrNotation : undefined; resourceInputs["deviceId"] = args ? args.deviceId : undefined; resourceInputs["address"] = undefined /*out*/; resourceInputs["addressFamily"] = undefined /*out*/; resourceInputs["cidr"] = undefined /*out*/; resourceInputs["gateway"] = undefined /*out*/; resourceInputs["global"] = undefined /*out*/; resourceInputs["manageable"] = undefined /*out*/; resourceInputs["management"] = undefined /*out*/; resourceInputs["netmask"] = undefined /*out*/; resourceInputs["network"] = undefined /*out*/; resourceInputs["public"] = undefined /*out*/; resourceInputs["vrfId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(IpAttachment.__pulumiType, name, resourceInputs, opts); } } exports.IpAttachment = IpAttachment; /** @internal */ IpAttachment.__pulumiType = 'equinix:metal/ipAttachment:IpAttachment'; //# sourceMappingURL=ipAttachment.js.map