@cuemby/equinix
Version:
A Pulumi package for creating and managing equinix cloud resources.
162 lines • 6.78 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.MetalPortVlanAttachment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a resource to attach device ports to VLANs.
*
* Device and VLAN must be in the same facility.
*
* If you need this resource to add the port back to bond on removal, set `forceBond = true`.
*
* To learn more about Layer 2 networking in Equinix Metal, refer to
*
* * <https://metal.equinix.com/developers/docs/networking/layer2/>
* * <https://metal.equinix.com/developers/docs/networking/layer2-configs/>
*
* ## Example Usage
* ### Hybrid network type
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as equinix from "@cuemby/equinix";
*
* const testMetalVlan = new equinix.MetalVlan("testMetalVlan", {
* description: "VLAN in New Jersey",
* facility: "ny5",
* projectId: local.project_id,
* });
* const testMetalDevice = new equinix.MetalDevice("testMetalDevice", {
* hostname: "test",
* plan: "c3.small.x86",
* facilities: ["ny5"],
* operatingSystem: "ubuntu_20_04",
* billingCycle: "hourly",
* projectId: local.project_id,
* });
* const testMetalDeviceNetworkType = new equinix.MetalDeviceNetworkType("testMetalDeviceNetworkType", {
* deviceId: testMetalDevice.id,
* type: "hybrid",
* });
* const testMetalPortVlanAttachment = new equinix.MetalPortVlanAttachment("testMetalPortVlanAttachment", {
* deviceId: testMetalDeviceNetworkType.id,
* portName: "eth1",
* vlanVnid: testMetalVlan.vxlan,
* });
* ```
* ### Layer 2 network
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as equinix from "@cuemby/equinix";
*
* const testMetalDevice = new equinix.MetalDevice("testMetalDevice", {
* hostname: "test",
* plan: "c3.small.x86",
* facilities: ["ny5"],
* operatingSystem: "ubuntu_20_04",
* billingCycle: "hourly",
* projectId: local.project_id,
* });
* const testMetalDeviceNetworkType = new equinix.MetalDeviceNetworkType("testMetalDeviceNetworkType", {
* deviceId: testMetalDevice.id,
* type: "layer2-individual",
* });
* const test1MetalVlan = new equinix.MetalVlan("test1MetalVlan", {
* description: "VLAN in New Jersey",
* facility: "ny5",
* projectId: local.project_id,
* });
* const test2MetalVlan = new equinix.MetalVlan("test2MetalVlan", {
* description: "VLAN in New Jersey",
* facility: "ny5",
* projectId: local.project_id,
* });
* const test1MetalPortVlanAttachment = new equinix.MetalPortVlanAttachment("test1MetalPortVlanAttachment", {
* deviceId: testMetalDeviceNetworkType.id,
* vlanVnid: test1MetalVlan.vxlan,
* portName: "eth1",
* });
* const test2MetalPortVlanAttachment = new equinix.MetalPortVlanAttachment("test2MetalPortVlanAttachment", {
* deviceId: testMetalDeviceNetworkType.id,
* vlanVnid: test2MetalVlan.vxlan,
* portName: "eth1",
* native: true,
* }, {
* dependsOn: ["equinix_metal_port_vlan_attachment.test1"],
* });
* ```
* ## Attribute Referece
*
* In addition to all arguments above, the following attributes are exported:
*
* * `id` - UUID of device port used in the assignment.
* * `vlanId` - UUID of VLAN API resource.
* * `portId` - UUID of device port.
*/
class MetalPortVlanAttachment extends pulumi.CustomResource {
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["deviceId"] = state ? state.deviceId : undefined;
resourceInputs["forceBond"] = state ? state.forceBond : undefined;
resourceInputs["native"] = state ? state.native : undefined;
resourceInputs["portId"] = state ? state.portId : undefined;
resourceInputs["portName"] = state ? state.portName : undefined;
resourceInputs["vlanId"] = state ? state.vlanId : undefined;
resourceInputs["vlanVnid"] = state ? state.vlanVnid : undefined;
}
else {
const args = argsOrState;
if ((!args || args.deviceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'deviceId'");
}
if ((!args || args.portName === undefined) && !opts.urn) {
throw new Error("Missing required property 'portName'");
}
if ((!args || args.vlanVnid === undefined) && !opts.urn) {
throw new Error("Missing required property 'vlanVnid'");
}
resourceInputs["deviceId"] = args ? args.deviceId : undefined;
resourceInputs["forceBond"] = args ? args.forceBond : undefined;
resourceInputs["native"] = args ? args.native : undefined;
resourceInputs["portName"] = args ? args.portName : undefined;
resourceInputs["vlanVnid"] = args ? args.vlanVnid : undefined;
resourceInputs["portId"] = undefined /*out*/;
resourceInputs["vlanId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(MetalPortVlanAttachment.__pulumiType, name, resourceInputs, opts);
}
/**
* Get an existing MetalPortVlanAttachment 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 MetalPortVlanAttachment(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of MetalPortVlanAttachment. 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'] === MetalPortVlanAttachment.__pulumiType;
}
}
exports.MetalPortVlanAttachment = MetalPortVlanAttachment;
/** @internal */
MetalPortVlanAttachment.__pulumiType = 'equinix:index/metalPortVlanAttachment:MetalPortVlanAttachment';
//# sourceMappingURL=metalPortVlanAttachment.js.map