UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

145 lines 5.89 kB
"use strict"; // *** 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.ServerCertificate = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an IAM Server Certificate resource to upload Server Certificates. * Certs uploaded to IAM can easily work with other AWS services such as: * * - AWS Elastic Beanstalk * - Elastic Load Balancing * - CloudFront * - AWS OpsWorks * * For information about server certificates in IAM, see [Managing Server * Certificates][2] in AWS Documentation. * * ## Example Usage * * **Using certs on file:** * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as std from "@pulumi/std"; * * const testCert = new aws.iam.ServerCertificate("test_cert", { * name: "some_test_cert", * certificateBody: std.file({ * input: "self-ca-cert.pem", * }).then(invoke => invoke.result), * privateKey: std.file({ * input: "test-key.pem", * }).then(invoke => invoke.result), * }); * ``` * * **Example with cert in-line:** * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const testCertAlt = new aws.iam.ServerCertificate("test_cert_alt", { * name: "alt_test_cert", * certificateBody: `-----BEGIN CERTIFICATE----- * [......] # cert contents * -----END CERTIFICATE----- * `, * privateKey: `-----BEGIN RSA PRIVATE KEY----- * [......] # cert contents * -----END RSA PRIVATE KEY----- * `, * }); * ``` * * **Use in combination with an AWS ELB resource:** * * Some properties of an IAM Server Certificates cannot be updated while they are * in use. In order for the provider to effectively manage a Certificate in this situation, it is * recommended you utilize the `namePrefix` attribute and enable the * `createBeforeDestroy`. This will allow this provider * to create a new, updated `aws.iam.ServerCertificate` resource and replace it in * dependant resources before attempting to destroy the old version. * * ## Import * * Using `pulumi import`, import IAM Server Certificates using the `name`. For example: * * ```sh * $ pulumi import aws:iam/serverCertificate:ServerCertificate certificate example.com-certificate-until-2018 * ``` */ class ServerCertificate extends pulumi.CustomResource { /** * Get an existing ServerCertificate 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 ServerCertificate(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ServerCertificate. 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'] === ServerCertificate.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["certificateBody"] = state?.certificateBody; resourceInputs["certificateChain"] = state?.certificateChain; resourceInputs["expiration"] = state?.expiration; resourceInputs["name"] = state?.name; resourceInputs["namePrefix"] = state?.namePrefix; resourceInputs["path"] = state?.path; resourceInputs["privateKey"] = state?.privateKey; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["uploadDate"] = state?.uploadDate; } else { const args = argsOrState; if (args?.certificateBody === undefined && !opts.urn) { throw new Error("Missing required property 'certificateBody'"); } if (args?.privateKey === undefined && !opts.urn) { throw new Error("Missing required property 'privateKey'"); } resourceInputs["certificateBody"] = args?.certificateBody; resourceInputs["certificateChain"] = args?.certificateChain; resourceInputs["name"] = args?.name; resourceInputs["namePrefix"] = args?.namePrefix; resourceInputs["path"] = args?.path; resourceInputs["privateKey"] = args?.privateKey ? pulumi.secret(args.privateKey) : undefined; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["expiration"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; resourceInputs["uploadDate"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["privateKey"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(ServerCertificate.__pulumiType, name, resourceInputs, opts); } } exports.ServerCertificate = ServerCertificate; /** @internal */ ServerCertificate.__pulumiType = 'aws:iam/serverCertificate:ServerCertificate'; //# sourceMappingURL=serverCertificate.js.map