How would I get something like this to work, the a...
# general
b
How would I get something like this to work, the aws.route53.Records don't seem to get executed:
Copy code
const cert = new aws.acm.Certificate("cert", {
        domainName             : opts.domainName,
        subjectAlternativeNames: opts.sans,
        validationMethod       : "DNS",
    });
    const certValidations = cert.domainValidationOptions.apply((validationOptions) => {
        return validationOptions.map((validationOption, i) => {
            const resourceName = `cert_validation${i}`;
            return new aws.route53.Record(resourceName, {
                records: [validationOption.resourceRecordValue],
                ttl: 60,
                type: validationOption.resourceRecordType,
                zoneId: zone.id,
            })
        });
    });

    const certValidation = new aws.acm.CertificateValidation("cert", {
        certificateArn: cert.arn,
        validationRecordFqdns: certValidations.apply((validations) => {
            return validations.map(validation => validation.fqdn);
        })
    })
w
Here's code I've used for this same purpose for an internal service:
Copy code
// Get certificate for desired endpoint
const certificate = new aws.acm.Certificate(name, {
    domainName: domainName,
    validationMethod: "DNS",
}, { provider: awsEastProvider });
const hostedZoneId = aws.route53.getZone({
    name: hostedZone,
}, { provider: awsProvider }).then(zone => zone.id);
const certificateValidationRecord = new aws.route53.Record(`${name}-validation`, {
    name: certificate.domainValidationOptions.apply(opt => opt[0].resourceRecordName),
    type: certificate.domainValidationOptions.apply(opt => opt[0].resourceRecordType),
    zoneId: hostedZoneId,
    records: [certificate.domainValidationOptions.apply(opt => opt[0].resourceRecordValue)],
    ttl: 60,
}, { provider: awsProvider });
const certificateValidation = new aws.acm.CertificateValidation(name, {
    certificateArn: certificate.arn,
    validationRecordFqdns: [certificateValidationRecord.fqdn],
}, { provider: awsEastProvider });
b
cool thanks
have you used the above code recently? I have to run pulumi up twice because the first time throws an error which looks like some kind of timing issue.