@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
118 lines • 4.84 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.KeyPair = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a Lightsail Key Pair for use with Lightsail Instances. Use this resource to create or import key pairs that are separate from EC2 Key Pairs and required for Lightsail instances.
*
* > **Note:** Lightsail is currently only supported in a limited number of AWS Regions, please see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details
*
* ## Example Usage
*
* ### Create New Key Pair
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.lightsail.KeyPair("example", {name: "example"});
* ```
*
* ### Create New Key Pair with PGP Encrypted Private Key
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.lightsail.KeyPair("example", {
* name: "example",
* pgpKey: "keybase:keybaseusername",
* });
* ```
*
* ### Existing Public Key Import
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* import * as std from "@pulumi/std";
*
* const example = new aws.lightsail.KeyPair("example", {
* name: "example",
* publicKey: std.file({
* input: "~/.ssh/id_rsa.pub",
* }).then(invoke => invoke.result),
* });
* ```
*
* ## Import
*
* You cannot import Lightsail Key Pairs because the private and public key are only available on initial creation.
*/
class KeyPair extends pulumi.CustomResource {
/**
* Get an existing KeyPair 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 KeyPair(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of KeyPair. 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'] === KeyPair.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["encryptedFingerprint"] = state?.encryptedFingerprint;
resourceInputs["encryptedPrivateKey"] = state?.encryptedPrivateKey;
resourceInputs["fingerprint"] = state?.fingerprint;
resourceInputs["name"] = state?.name;
resourceInputs["namePrefix"] = state?.namePrefix;
resourceInputs["pgpKey"] = state?.pgpKey;
resourceInputs["privateKey"] = state?.privateKey;
resourceInputs["publicKey"] = state?.publicKey;
resourceInputs["region"] = state?.region;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
resourceInputs["name"] = args?.name;
resourceInputs["namePrefix"] = args?.namePrefix;
resourceInputs["pgpKey"] = args?.pgpKey;
resourceInputs["publicKey"] = args?.publicKey;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["encryptedFingerprint"] = undefined /*out*/;
resourceInputs["encryptedPrivateKey"] = undefined /*out*/;
resourceInputs["fingerprint"] = undefined /*out*/;
resourceInputs["privateKey"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(KeyPair.__pulumiType, name, resourceInputs, opts);
}
}
exports.KeyPair = KeyPair;
/** @internal */
KeyPair.__pulumiType = 'aws:lightsail/keyPair:KeyPair';
//# sourceMappingURL=keyPair.js.map