@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
168 lines • 7.2 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.CertificateValidation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* This resource represents a successful validation of an ACM certificate in concert
* with other resources.
*
* Most commonly, this resource is used together with `aws.route53.Record` and
* `aws.acm.Certificate` to request a DNS validated certificate,
* deploy the required validation records and wait for validation to complete.
*
* > **WARNING:** This resource implements a part of the validation workflow. It does not represent a real-world entity in AWS, therefore changing or deleting this resource on its own has no immediate effect.
*
* ## Example Usage
*
* ### DNS Validation with Route 53
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const exampleCertificate = new aws.acm.Certificate("example", {
* domainName: "example.com",
* validationMethod: "DNS",
* });
* const example = aws.route53.getZone({
* name: "example.com",
* privateZone: false,
* });
* const exampleRecord: aws.route53.Record[] = [];
* exampleCertificate.domainValidationOptions.apply(domainValidationOptions => {
* for (const range of Object.entries(domainValidationOptions.reduce((__obj, dvo) => ({ ...__obj, [dvo.domainName]: {
* name: dvo.resourceRecordName,
* record: dvo.resourceRecordValue,
* type: dvo.resourceRecordType,
* } }))).map(([k, v]) => ({key: k, value: v}))) {
* exampleRecord.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: example.then(example => example.zoneId),
* }));
* }
* });
* const exampleCertificateValidation = new aws.acm.CertificateValidation("example", {
* certificateArn: exampleCertificate.arn,
* validationRecordFqdns: exampleRecord.apply(exampleRecord => exampleRecord.map(record => (record.fqdn))),
* });
* const exampleListener = new aws.lb.Listener("example", {certificateArn: exampleCertificateValidation.certificateArn});
* ```
*
* ### Alternative Domains DNS Validation with Route 53
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.acm.Certificate("example", {
* domainName: "example.com",
* subjectAlternativeNames: [
* "www.example.com",
* "example.org",
* ],
* validationMethod: "DNS",
* });
* const exampleCom = aws.route53.getZone({
* name: "example.com",
* privateZone: false,
* });
* const exampleOrg = aws.route53.getZone({
* name: "example.org",
* privateZone: false,
* });
* const exampleRecord: aws.route53.Record[] = [];
* pulumi.all([example.domainValidationOptions, dvo.domainName == "example.org" ? exampleOrg.then(exampleOrg => exampleOrg.zoneId) : exampleCom.then(exampleCom => exampleCom.zoneId)]).apply(([domainValidationOptions, value]) => {
* for (const range of Object.entries(domainValidationOptions.reduce((__obj, dvo) => ({ ...__obj, [dvo.domainName]: {
* name: dvo.resourceRecordName,
* record: dvo.resourceRecordValue,
* type: dvo.resourceRecordType,
* zoneId: value,
* } }))).map(([k, v]) => ({key: k, value: v}))) {
* exampleRecord.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: range.value.zoneId,
* }));
* }
* });
* const exampleCertificateValidation = new aws.acm.CertificateValidation("example", {
* certificateArn: example.arn,
* validationRecordFqdns: exampleRecord.apply(exampleRecord => exampleRecord.map(record => (record.fqdn))),
* });
* const exampleListener = new aws.lb.Listener("example", {certificateArn: exampleCertificateValidation.certificateArn});
* ```
*
* ### Email Validation
*
* In this situation, the resource is simply a waiter for manual email approval of ACM certificates.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.acm.Certificate("example", {
* domainName: "example.com",
* validationMethod: "EMAIL",
* });
* const exampleCertificateValidation = new aws.acm.CertificateValidation("example", {certificateArn: example.arn});
* ```
*/
class CertificateValidation extends pulumi.CustomResource {
/**
* Get an existing CertificateValidation 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 CertificateValidation(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of CertificateValidation. 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'] === CertificateValidation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["certificateArn"] = state?.certificateArn;
resourceInputs["region"] = state?.region;
resourceInputs["validationRecordFqdns"] = state?.validationRecordFqdns;
}
else {
const args = argsOrState;
if (args?.certificateArn === undefined && !opts.urn) {
throw new Error("Missing required property 'certificateArn'");
}
resourceInputs["certificateArn"] = args?.certificateArn;
resourceInputs["region"] = args?.region;
resourceInputs["validationRecordFqdns"] = args?.validationRecordFqdns;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CertificateValidation.__pulumiType, name, resourceInputs, opts);
}
}
exports.CertificateValidation = CertificateValidation;
/** @internal */
CertificateValidation.__pulumiType = 'aws:acm/certificateValidation:CertificateValidation';
//# sourceMappingURL=certificateValidation.js.map
;