@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
123 lines • 4.95 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.AccessKey = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an IAM access key. This is a set of credentials that allow API requests to be made as an IAM user.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const lbUser = new aws.iam.User("lb", {
* name: "loadbalancer",
* path: "/system/",
* });
* const lb = new aws.iam.AccessKey("lb", {
* user: lbUser.name,
* pgpKey: "keybase:some_person_that_exists",
* });
* const lbRo = aws.iam.getPolicyDocument({
* statements: [{
* effect: "Allow",
* actions: ["ec2:Describe*"],
* resources: ["*"],
* }],
* });
* const lbRoUserPolicy = new aws.iam.UserPolicy("lb_ro", {
* name: "test",
* user: lbUser.name,
* policy: lbRo.then(lbRo => lbRo.json),
* });
* export const secret = lb.encryptedSecret;
* ```
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const test = new aws.iam.User("test", {
* name: "test",
* path: "/test/",
* });
* const testAccessKey = new aws.iam.AccessKey("test", {user: test.name});
* export const awsIamSmtpPasswordV4 = testAccessKey.sesSmtpPasswordV4;
* ```
*
* ## Import
*
* Using `pulumi import`, import IAM Access Keys using the identifier. For example:
*
* ```sh
* $ pulumi import aws:iam/accessKey:AccessKey example AKIA1234567890
* ```
* Resource attributes such as `encrypted_secret`, `key_fingerprint`, `pgp_key`, `secret`, `ses_smtp_password_v4`, and `encrypted_ses_smtp_password_v4` are not available for imported resources as this information cannot be read from the IAM API.
*/
class AccessKey extends pulumi.CustomResource {
/**
* Get an existing AccessKey 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 AccessKey(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AccessKey. 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'] === AccessKey.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createDate"] = state?.createDate;
resourceInputs["encryptedSecret"] = state?.encryptedSecret;
resourceInputs["encryptedSesSmtpPasswordV4"] = state?.encryptedSesSmtpPasswordV4;
resourceInputs["keyFingerprint"] = state?.keyFingerprint;
resourceInputs["pgpKey"] = state?.pgpKey;
resourceInputs["secret"] = state?.secret;
resourceInputs["sesSmtpPasswordV4"] = state?.sesSmtpPasswordV4;
resourceInputs["status"] = state?.status;
resourceInputs["user"] = state?.user;
}
else {
const args = argsOrState;
if (args?.user === undefined && !opts.urn) {
throw new Error("Missing required property 'user'");
}
resourceInputs["pgpKey"] = args?.pgpKey;
resourceInputs["status"] = args?.status;
resourceInputs["user"] = args?.user;
resourceInputs["createDate"] = undefined /*out*/;
resourceInputs["encryptedSecret"] = undefined /*out*/;
resourceInputs["encryptedSesSmtpPasswordV4"] = undefined /*out*/;
resourceInputs["keyFingerprint"] = undefined /*out*/;
resourceInputs["secret"] = undefined /*out*/;
resourceInputs["sesSmtpPasswordV4"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["secret", "sesSmtpPasswordV4"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(AccessKey.__pulumiType, name, resourceInputs, opts);
}
}
exports.AccessKey = AccessKey;
/** @internal */
AccessKey.__pulumiType = 'aws:iam/accessKey:AccessKey';
//# sourceMappingURL=accessKey.js.map
;