Is something like this possible with pulumi? ```co...
# typescript
a
Is something like this possible with pulumi?
Copy code
const orgCertificate = new acm.Certificate('org-certificate', {
    domainName: orgZone.name,
    validationMethod: 'DNS'
})

let validationRecords: pulumi.Output<string>[] = []

for (let i in orgCertificate.domainValidationOptions) {
    validationRecords.push(
        new route53.Record(`org-validation-record-${i}`, {
            name: orgCertificate.domainValidationOptions[i].resourceRecordName,
            type: orgCertificate.domainValidationOptions[i].resourceRecordType,
            records: [ orgCertificate.domainValidationOptions[i].resourceRecordValue ],
            zoneId: orgZone.zoneId,
            ttl: 60,
            allowOverwrite: true
        }).fqdn
    )
}

new acm.CertificateValidation('org-certificate-validation', {
    certificateArn: orgCertificate.arn,
    validationRecordFqdns: validationRecords
})
I get this error:
Copy code
error: Running program '/Users/mallison/workspace/gdsgroup/equiv/immersify' failed with an unhandled exception:
    Error: Missing required property 'name'
at new Record (/Users/MYNAME/workspace/DIR/DIR/DIR/node_modules/@pulumi/route53/record.ts:246:23)
āœ… 1
w
My gut feeling is that when creating the `route53.Record`the
orgCertificate.domain.ValidationOptions[i].resoruceRecordName
is undefined. So, using
apply()
to reconcile the promise should fix that. Try changing the
name
property setting to the following:
Copy code
name: orgCertificate.domainValidationOptions[i].resourceRecordName.apply(resourceRecordName => resourceRecordName)
More discussion of these concepts can be found here: https://www.pulumi.com/docs/intro/concepts/inputs-outputs/# And here: https://www.leebriggs.co.uk/blog/2021/05/09/pulumi-apply.html
a
Hi @witty-candle-66007 I tried the following:
Copy code
name: orgCertificate.domainValidationOptions.apply(domainValidationOptions => domainValidationOptions)[i].resourceRecordName

 error: Running program '/Users/mallison/workspace/gdsgroup/immersify' failed with an unhandled exception:
    Error: Missing required property 'name'
        at new Record (/Users/mallison/workspace/gdsgroup/immersify/node_modules/@pulumi/route53/record.ts:246:23)
Your suggestion:
Copy code
name: orgCertificate.domainValidationOptions[i].resourceRecordName.apply(resourceRecordName => resourceRecordName)

error: Running program '/Users/mallison/workspace/gdsgroup/immersify' failed with an unhandled exception:
    TypeError: Cannot read property 'apply' of undefined
And finally:
Copy code
name: orgCertificate.domainValidationOptions.apply(domainValidationOptions => domainValidationOptions[i].resourceRecordName)
Which worked šŸ‘ Thanks for your help on this
w
Iā€™m glad you were able to work past my incorrect example. šŸ™‚