UNPKG

@cuemby/equinix

Version:

A Pulumi package for creating and managing equinix cloud resources.

98 lines 4.31 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.MetalSSHKey = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a resource to manage User SSH keys on your Equinix Metal user account. If you create a new device in a project, all the keys of the project's collaborators will be injected to the device. * * The link between User SSH key and device is implicit. If you want to make sure that a key will be copied to a device, you must ensure that the device resource `dependsOn` the key resource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as equinix from "@cuemby/equinix"; * import * from "fs"; * * // Create a new SSH key * const key1 = new equinix.MetalSSHKey("key1", {publicKey: fs.readFileSync("/home/terraform/.ssh/id_rsa.pub")}); * // Create new device with "key1" included. The device resource "depends_on" the * // key, in order to make sure the key is created before the device. * const test = new equinix.MetalDevice("test", { * hostname: "test-device", * plan: "c3.small.x86", * metro: "sv", * operatingSystem: "ubuntu_20_04", * billingCycle: "hourly", * projectId: local.project_id, * }, { * dependsOn: ["equinix_metal_ssh_key.key1"], * }); * ``` * * ## Import * * This resource can be imported using an existing SSH Key ID * * ```sh * $ pulumi import equinix:index/metalSSHKey:MetalSSHKey equinix_metal_ssh_key {existing_sshkey_id} * ``` */ class MetalSSHKey extends pulumi.CustomResource { constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["created"] = state ? state.created : undefined; resourceInputs["fingerprint"] = state ? state.fingerprint : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["ownerId"] = state ? state.ownerId : undefined; resourceInputs["publicKey"] = state ? state.publicKey : undefined; resourceInputs["updated"] = state ? state.updated : undefined; } else { const args = argsOrState; if ((!args || args.publicKey === undefined) && !opts.urn) { throw new Error("Missing required property 'publicKey'"); } resourceInputs["name"] = args ? args.name : undefined; resourceInputs["publicKey"] = args ? args.publicKey : undefined; resourceInputs["created"] = undefined /*out*/; resourceInputs["fingerprint"] = undefined /*out*/; resourceInputs["ownerId"] = undefined /*out*/; resourceInputs["updated"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(MetalSSHKey.__pulumiType, name, resourceInputs, opts); } /** * Get an existing MetalSSHKey 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 MetalSSHKey(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of MetalSSHKey. 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'] === MetalSSHKey.__pulumiType; } } exports.MetalSSHKey = MetalSSHKey; /** @internal */ MetalSSHKey.__pulumiType = 'equinix:index/metalSSHKey:MetalSSHKey'; //# sourceMappingURL=metalSSHKey.js.map