@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
139 lines • 5.04 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.SshKey = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a AWS Transfer User SSH Key resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* import * as std from "@pulumi/std";
* import * as tls from "@pulumi/tls";
*
* const examplePrivateKey = new tls.PrivateKey("example", {
* algorithm: "RSA",
* rsaBits: 4096,
* });
* const exampleServer = new aws.transfer.Server("example", {
* identityProviderType: "SERVICE_MANAGED",
* tags: {
* NAME: "tf-acc-test-transfer-server",
* },
* });
* const assumeRole = aws.iam.getPolicyDocument({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "Service",
* identifiers: ["transfer.amazonaws.com"],
* }],
* actions: ["sts:AssumeRole"],
* }],
* });
* const exampleRole = new aws.iam.Role("example", {
* name: "tf-test-transfer-user-iam-role",
* assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
* });
* const exampleUser = new aws.transfer.User("example", {
* serverId: exampleServer.id,
* userName: "tftestuser",
* role: exampleRole.arn,
* tags: {
* NAME: "tftestuser",
* },
* });
* const exampleSshKey = new aws.transfer.SshKey("example", {
* serverId: exampleServer.id,
* userName: exampleUser.userName,
* body: std.trimspaceOutput({
* input: examplePrivateKey.publicKeyOpenssh,
* }).apply(invoke => invoke.result),
* });
* const example = aws.iam.getPolicyDocument({
* statements: [{
* sid: "AllowFullAccesstoS3",
* effect: "Allow",
* actions: ["s3:*"],
* resources: ["*"],
* }],
* });
* const exampleRolePolicy = new aws.iam.RolePolicy("example", {
* name: "tf-test-transfer-user-iam-policy",
* role: exampleRole.id,
* policy: example.then(example => example.json),
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Transfer SSH Public Key using the `server_id` and `user_name` and `ssh_public_key_id` separated by `/`. For example:
*
* ```sh
* $ pulumi import aws:transfer/sshKey:SshKey bar s-12345678/test-username/key-12345
* ```
*/
class SshKey extends pulumi.CustomResource {
/**
* Get an existing SshKey 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 SshKey(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of SshKey. 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'] === SshKey.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["body"] = state?.body;
resourceInputs["region"] = state?.region;
resourceInputs["serverId"] = state?.serverId;
resourceInputs["sshKeyId"] = state?.sshKeyId;
resourceInputs["userName"] = state?.userName;
}
else {
const args = argsOrState;
if (args?.body === undefined && !opts.urn) {
throw new Error("Missing required property 'body'");
}
if (args?.serverId === undefined && !opts.urn) {
throw new Error("Missing required property 'serverId'");
}
if (args?.userName === undefined && !opts.urn) {
throw new Error("Missing required property 'userName'");
}
resourceInputs["body"] = args?.body;
resourceInputs["region"] = args?.region;
resourceInputs["serverId"] = args?.serverId;
resourceInputs["userName"] = args?.userName;
resourceInputs["sshKeyId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SshKey.__pulumiType, name, resourceInputs, opts);
}
}
exports.SshKey = SshKey;
/** @internal */
SshKey.__pulumiType = 'aws:transfer/sshKey:SshKey';
//# sourceMappingURL=sshKey.js.map