certificate-manager: DnsValidatedCertificate ignores validations property #21040
Labels
@aws-cdk/aws-certificatemanager
Related to Amazon Certificate Manager
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
Describe the bug
We can use the
CertificateProps.validation
property to configure DNS validation for an ACM certificate associated with multiple Route53-hosted domains. We can also use theDnsValidatedCertificateProps.region
property to provision an ACM cert with DNS validation inus-east-1
(or any region) when we deploy to a different region (e.g., for use with CloudFront Distributions). Unfortunately, there is no way to combine these benefits. There is noCertificateProps.region
property, and althoughDnsValidatedCertificateProps
extendsCertificateProps
, theDnsValidatedCertificateProps.validation
property is apparently ignored byDnsValidatedCertificate
. This latter behavior feels like a bug.Expected Behavior
I can define a stack with a
DnsValidatedCertificate
construct like so:then deploy this stack to any region and end up with an ACM cert in
us-east-1
with the appropriate DNS validation record sets in the provided hosted zones.Current Behavior
Synthesizing the above
DnsValidatedCertificate
results in a CloudFormation resource like this (values redacted with...
):As you can see, the DomainValidationOptions property is missing. The CloudFormation custom resource created by CDK to provision the ACM cert in
us-east-1
attempts to add all of theDomainValidationOptions
from the DescribeCertificate API to theDnsValidatedCertificateProps.hostedZone
, rather than adding domain validation options to each of the necessary hosted zones, so the CDK stack fails to deploy with a message like:Reproduction Steps
DnsValidatedCertificate
construct.cdk synth
this app and observe the CloudFormation resources described above.cdk deploy
this app to a region other thanus-east-1
and observe the error mentioned above.Possible Solution
The
DnsValidatedCertificate
construct should actually use theCertificateProps.validations
property. Also, thehostedZone
property should be optional ifvalidations
are provided, so that no particular hosted zone is "singled out" and duplicated. The Lambda function code generated byDnsValidatedCertificate
must then add DNS validation records to the appropriate hosted zones fromvalidations
and not just assume the singularhostedZone
will work for them all.Additional Information/Context
No response
CDK CLI Version
2.30.0 (build 1529743)
Framework Version
No response
Node.js Version
v16.15.1
OS
Linux (Debian bullseye)
Language
Typescript
Language Version
4.7.4
Other information
Technically running in a WSL devcontainer on Windows 11 Pro
The text was updated successfully, but these errors were encountered: