@equinix-labs/pulumi-equinix
Version:
A Pulumi package for creating and managing equinix cloud resources.
231 lines • 12.9 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.Device = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an Equinix Metal device resource. This can be used to create, modify, and delete devices.
*
* > **NOTE:** All arguments including the `rootPassword` and `userData` will be stored in the raw state as plain-text. Read more about sensitive data in state.
*
* ## Example Usage
* ### example 1
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as equinix from "@equinix-labs/pulumi-equinix";
*
* const web1 = new equinix.metal.Device("web1", {
* hostname: "tf.coreos2",
* plan: equinix.metal.Plan.C3SmallX86,
* metro: "sv",
* operatingSystem: equinix.metal.OperatingSystem.Ubuntu20_04,
* billingCycle: equinix.metal.BillingCycle.Hourly,
* projectId: projectId,
* });
* ```
* ### example 2
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as equinix from "@equinix-labs/pulumi-equinix";
*
* const pxe1 = new equinix.metal.Device("pxe1", {
* hostname: "tf.coreos2-pxe",
* plan: equinix.metal.Plan.C3SmallX86,
* metro: "sv",
* operatingSystem: equinix.metal.OperatingSystem.CustomIPXE,
* billingCycle: equinix.metal.BillingCycle.Hourly,
* projectId: projectId,
* ipxeScriptUrl: "https://rawgit.com/cloudnativelabs/pxe/master/packet/coreos-stable-metal.ipxe",
* alwaysPxe: false,
* userData: example.rendered,
* });
* ```
* ### example 3
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as equinix from "@equinix-labs/pulumi-equinix";
*
* const web1 = new equinix.metal.Device("web1", {
* hostname: "tf.coreos2",
* plan: equinix.metal.Plan.C3SmallX86,
* metro: "ny",
* operatingSystem: equinix.metal.OperatingSystem.Ubuntu20_04,
* billingCycle: equinix.metal.BillingCycle.Hourly,
* projectId: projectId,
* ipAddresses: [{
* type: "private_ipv4",
* cidr: 30,
* }],
* });
* ```
* ### example 4
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as equinix from "@equinix-labs/pulumi-equinix";
*
* const web1 = new equinix.metal.Device("web1", {
* hostname: "tftest",
* plan: equinix.metal.Plan.C3SmallX86,
* metro: "ny",
* operatingSystem: equinix.metal.OperatingSystem.Ubuntu20_04,
* billingCycle: equinix.metal.BillingCycle.Hourly,
* projectId: projectId,
* hardwareReservationId: "next-available",
* storage: "{ \\"disks\\": [ { \\"device\\": \\"/dev/sda\\", \\"wipeTable\\": true, \\"partitions\\": [ { \\"label\\": \\"BIOS\\", \\"number\\": 1, \\"size\\": \\"4096\\" }, { \\"label\\": \\"SWAP\\", \\"number\\": 2, \\"size\\": \\"3993600\\" }, { \\"label\\": \\"ROOT\\", \\"number\\": 3, \\"size\\": \\"0\\" } ] } ], \\"filesystems\\": [ { \\"mount\\": { \\"device\\": \\"/dev/sda3\\", \\"format\\": \\"ext4\\", \\"point\\": \\"/\\", \\"create\\": { \\"options\\": [ \\"-L\\", \\"ROOT\\" ] } } }, { \\"mount\\": { \\"device\\": \\"/dev/sda2\\", \\"format\\": \\"swap\\", \\"point\\": \\"none\\", \\"create\\": { \\"options\\": [ \\"-L\\", \\"SWAP\\" ] } } } ]}
* ",
* });
* ```
* ### example 5
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as equinix from "@equinix-labs/pulumi-equinix";
*
* const pxe1 = new equinix.metal.Device("pxe1", {
* hostname: "tf.coreos2-pxe",
* plan: equinix.metal.Plan.C3SmallX86,
* metro: "sv",
* operatingSystem: equinix.metal.OperatingSystem.CustomIPXE,
* billingCycle: equinix.metal.BillingCycle.Hourly,
* projectId: projectId,
* ipxeScriptUrl: "https://rawgit.com/cloudnativelabs/pxe/master/packet/coreos-stable-metal.ipxe",
* alwaysPxe: false,
* userData: userData,
* customData: customData,
* behavior: {
* allowChanges: [
* "custom_data",
* "user_data",
* ],
* },
* });
* ```
*/
class Device extends pulumi.CustomResource {
/**
* Get an existing Device 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 Device(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Device. 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'] === Device.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessPrivateIpv4"] = state ? state.accessPrivateIpv4 : undefined;
resourceInputs["accessPublicIpv4"] = state ? state.accessPublicIpv4 : undefined;
resourceInputs["accessPublicIpv6"] = state ? state.accessPublicIpv6 : undefined;
resourceInputs["alwaysPxe"] = state ? state.alwaysPxe : undefined;
resourceInputs["behavior"] = state ? state.behavior : undefined;
resourceInputs["billingCycle"] = state ? state.billingCycle : undefined;
resourceInputs["created"] = state ? state.created : undefined;
resourceInputs["customData"] = state ? state.customData : undefined;
resourceInputs["deployedFacility"] = state ? state.deployedFacility : undefined;
resourceInputs["deployedHardwareReservationId"] = state ? state.deployedHardwareReservationId : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["facilities"] = state ? state.facilities : undefined;
resourceInputs["forceDetachVolumes"] = state ? state.forceDetachVolumes : undefined;
resourceInputs["hardwareReservationId"] = state ? state.hardwareReservationId : undefined;
resourceInputs["hostname"] = state ? state.hostname : undefined;
resourceInputs["ipAddresses"] = state ? state.ipAddresses : undefined;
resourceInputs["ipxeScriptUrl"] = state ? state.ipxeScriptUrl : undefined;
resourceInputs["locked"] = state ? state.locked : undefined;
resourceInputs["metro"] = state ? state.metro : undefined;
resourceInputs["network"] = state ? state.network : undefined;
resourceInputs["networkType"] = state ? state.networkType : undefined;
resourceInputs["operatingSystem"] = state ? state.operatingSystem : undefined;
resourceInputs["plan"] = state ? state.plan : undefined;
resourceInputs["ports"] = state ? state.ports : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["projectSshKeyIds"] = state ? state.projectSshKeyIds : undefined;
resourceInputs["reinstall"] = state ? state.reinstall : undefined;
resourceInputs["rootPassword"] = state ? state.rootPassword : undefined;
resourceInputs["sosHostname"] = state ? state.sosHostname : undefined;
resourceInputs["sshKeyIds"] = state ? state.sshKeyIds : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["storage"] = state ? state.storage : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["terminationTime"] = state ? state.terminationTime : undefined;
resourceInputs["updated"] = state ? state.updated : undefined;
resourceInputs["userData"] = state ? state.userData : undefined;
resourceInputs["userSshKeyIds"] = state ? state.userSshKeyIds : undefined;
resourceInputs["waitForReservationDeprovision"] = state ? state.waitForReservationDeprovision : undefined;
}
else {
const args = argsOrState;
if ((!args || args.operatingSystem === undefined) && !opts.urn) {
throw new Error("Missing required property 'operatingSystem'");
}
if ((!args || args.plan === undefined) && !opts.urn) {
throw new Error("Missing required property 'plan'");
}
if ((!args || args.projectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
resourceInputs["alwaysPxe"] = args ? args.alwaysPxe : undefined;
resourceInputs["behavior"] = args ? args.behavior : undefined;
resourceInputs["billingCycle"] = args ? args.billingCycle : undefined;
resourceInputs["customData"] = (args === null || args === void 0 ? void 0 : args.customData) ? pulumi.secret(args.customData) : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["facilities"] = args ? args.facilities : undefined;
resourceInputs["forceDetachVolumes"] = args ? args.forceDetachVolumes : undefined;
resourceInputs["hardwareReservationId"] = args ? args.hardwareReservationId : undefined;
resourceInputs["hostname"] = args ? args.hostname : undefined;
resourceInputs["ipAddresses"] = args ? args.ipAddresses : undefined;
resourceInputs["ipxeScriptUrl"] = args ? args.ipxeScriptUrl : undefined;
resourceInputs["locked"] = args ? args.locked : undefined;
resourceInputs["metro"] = args ? args.metro : undefined;
resourceInputs["operatingSystem"] = args ? args.operatingSystem : undefined;
resourceInputs["plan"] = args ? args.plan : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["projectSshKeyIds"] = args ? args.projectSshKeyIds : undefined;
resourceInputs["reinstall"] = args ? args.reinstall : undefined;
resourceInputs["storage"] = args ? args.storage : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["terminationTime"] = args ? args.terminationTime : undefined;
resourceInputs["userData"] = (args === null || args === void 0 ? void 0 : args.userData) ? pulumi.secret(args.userData) : undefined;
resourceInputs["userSshKeyIds"] = args ? args.userSshKeyIds : undefined;
resourceInputs["waitForReservationDeprovision"] = args ? args.waitForReservationDeprovision : undefined;
resourceInputs["accessPrivateIpv4"] = undefined /*out*/;
resourceInputs["accessPublicIpv4"] = undefined /*out*/;
resourceInputs["accessPublicIpv6"] = undefined /*out*/;
resourceInputs["created"] = undefined /*out*/;
resourceInputs["deployedFacility"] = undefined /*out*/;
resourceInputs["deployedHardwareReservationId"] = undefined /*out*/;
resourceInputs["network"] = undefined /*out*/;
resourceInputs["networkType"] = undefined /*out*/;
resourceInputs["ports"] = undefined /*out*/;
resourceInputs["rootPassword"] = undefined /*out*/;
resourceInputs["sosHostname"] = undefined /*out*/;
resourceInputs["sshKeyIds"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["updated"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["customData", "rootPassword", "userData"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Device.__pulumiType, name, resourceInputs, opts);
}
}
exports.Device = Device;
/** @internal */
Device.__pulumiType = 'equinix:metal/device:Device';
//# sourceMappingURL=device.js.map