@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
215 lines • 10 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.Certificate = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* The ACM certificate resource allows requesting and management of certificates
* from the Amazon Certificate Manager.
*
* ACM certificates can be created in three ways:
* Amazon-issued, where AWS provides the certificate authority and automatically manages renewal;
* imported certificates, issued by another certificate authority;
* and private certificates, issued using an ACM Private Certificate Authority.
*
* ## Amazon-Issued Certificates
*
* For Amazon-issued certificates, this resource deals with requesting certificates and managing their attributes and life-cycle.
* This resource does not deal with validation of a certificate but can provide inputs
* for other resources implementing the validation.
* It does not wait for a certificate to be issued.
* Use a `aws.acm.CertificateValidation` resource for this.
*
* Most commonly, this resource is used together with `aws.route53.Record` and
* `aws.acm.CertificateValidation` to request a DNS validated certificate,
* deploy the required validation records and wait for validation to complete.
*
* Domain validation through email is also supported but should be avoided as it requires a manual step outside of this provider.
*
* ## Certificates Imported from Other Certificate Authority
*
* Imported certificates can be used to make certificates created with an external certificate authority available for AWS services.
*
* As they are not managed by AWS, imported certificates are not eligible for automatic renewal.
* New certificate materials can be supplied to an existing imported certificate to update it in place.
*
* ## Private Certificates
*
* Private certificates are issued by an ACM Private Certificate Authority, which can be created using the resource type `aws.acmpca.CertificateAuthority`.
*
* Private certificates created using this resource are eligible for managed renewal if they have been exported or associated with another AWS service.
* See [managed renewal documentation](https://docs.aws.amazon.com/acm/latest/userguide/managed-renewal.html) for more information.
* By default, a certificate is valid for 395 days and the managed renewal process will start 60 days before expiration.
* To renew the certificate earlier than 60 days before expiration, configure `earlyRenewalDuration`.
*
* ## Example Usage
*
* ### Custom Domain Validation Options
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const cert = new aws.acm.Certificate("cert", {
* domainName: "testing.example.com",
* validationMethod: "EMAIL",
* validationOptions: [{
* domainName: "testing.example.com",
* validationDomain: "example.com",
* }],
* });
* ```
*
* ### Existing Certificate Body Import
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* import * as tls from "@pulumi/tls";
*
* const example = new tls.index.PrivateKey("example", {algorithm: "RSA"});
* const exampleSelfSignedCert = new tls.index.SelfSignedCert("example", {
* keyAlgorithm: "RSA",
* privateKeyPem: example.privateKeyPem,
* subject: [{
* commonName: "example.com",
* organization: "ACME Examples, Inc",
* }],
* validityPeriodHours: 12,
* allowedUses: [
* "key_encipherment",
* "digital_signature",
* "server_auth",
* ],
* });
* const cert = new aws.acm.Certificate("cert", {
* privateKey: example.privateKeyPem,
* certificateBody: exampleSelfSignedCert.certPem,
* });
* ```
*
* ### Referencing domainValidationOptions With forEach Based Resources
*
* See the `aws.acm.CertificateValidation` resource for a full example of performing DNS validation.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example: aws.route53.Record[] = [];
* for (const range of Object.entries(.reduce((__obj, dvo) => ({ ...__obj, [dvo.domainName]: {
* name: dvo.resourceRecordName,
* record: dvo.resourceRecordValue,
* type: dvo.resourceRecordType,
* } }))).map(([k, v]) => ({key: k, value: v}))) {
* example.push(new aws.route53.Record(`example-${range.key}`, {
* allowOverwrite: true,
* name: range.value.name,
* records: [range.value.record],
* ttl: 60,
* type: aws.route53.RecordType[range.value.type],
* zoneId: exampleAwsRoute53Zone.zoneId,
* }));
* }
* ```
*
* ## Import
*
* Using `pulumi import`, import certificates using their ARN. For example:
*
* ```sh
* $ pulumi import aws:acm/certificate:Certificate cert arn:aws:acm:eu-central-1:123456789012:certificate/7e7a28d2-163f-4b8f-b9cd-822f96c08d6a
* ```
*/
class Certificate extends pulumi.CustomResource {
/**
* Get an existing Certificate 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 Certificate(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Certificate. 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'] === Certificate.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["certificateAuthorityArn"] = state?.certificateAuthorityArn;
resourceInputs["certificateBody"] = state?.certificateBody;
resourceInputs["certificateChain"] = state?.certificateChain;
resourceInputs["domainName"] = state?.domainName;
resourceInputs["domainValidationOptions"] = state?.domainValidationOptions;
resourceInputs["earlyRenewalDuration"] = state?.earlyRenewalDuration;
resourceInputs["keyAlgorithm"] = state?.keyAlgorithm;
resourceInputs["notAfter"] = state?.notAfter;
resourceInputs["notBefore"] = state?.notBefore;
resourceInputs["options"] = state?.options;
resourceInputs["pendingRenewal"] = state?.pendingRenewal;
resourceInputs["privateKey"] = state?.privateKey;
resourceInputs["region"] = state?.region;
resourceInputs["renewalEligibility"] = state?.renewalEligibility;
resourceInputs["renewalSummaries"] = state?.renewalSummaries;
resourceInputs["status"] = state?.status;
resourceInputs["subjectAlternativeNames"] = state?.subjectAlternativeNames;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["type"] = state?.type;
resourceInputs["validationEmails"] = state?.validationEmails;
resourceInputs["validationMethod"] = state?.validationMethod;
resourceInputs["validationOptions"] = state?.validationOptions;
}
else {
const args = argsOrState;
resourceInputs["certificateAuthorityArn"] = args?.certificateAuthorityArn;
resourceInputs["certificateBody"] = args?.certificateBody;
resourceInputs["certificateChain"] = args?.certificateChain;
resourceInputs["domainName"] = args?.domainName;
resourceInputs["earlyRenewalDuration"] = args?.earlyRenewalDuration;
resourceInputs["keyAlgorithm"] = args?.keyAlgorithm;
resourceInputs["options"] = args?.options;
resourceInputs["privateKey"] = args?.privateKey ? pulumi.secret(args.privateKey) : undefined;
resourceInputs["region"] = args?.region;
resourceInputs["subjectAlternativeNames"] = args?.subjectAlternativeNames;
resourceInputs["tags"] = args?.tags;
resourceInputs["validationMethod"] = args?.validationMethod;
resourceInputs["validationOptions"] = args?.validationOptions;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["domainValidationOptions"] = undefined /*out*/;
resourceInputs["notAfter"] = undefined /*out*/;
resourceInputs["notBefore"] = undefined /*out*/;
resourceInputs["pendingRenewal"] = undefined /*out*/;
resourceInputs["renewalEligibility"] = undefined /*out*/;
resourceInputs["renewalSummaries"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
resourceInputs["validationEmails"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["privateKey"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Certificate.__pulumiType, name, resourceInputs, opts);
}
}
exports.Certificate = Certificate;
/** @internal */
Certificate.__pulumiType = 'aws:acm/certificate:Certificate';
//# sourceMappingURL=certificate.js.map
;