Categories
Mastering Development

How to specify a validation domain for AWS CDK when using tokens for domain names

I’m requesting a domain certificate from an AWS CDK stack.
For the domain name, I use a value from AWS Parameter Store like:

const domainName = StringParameter.valueForStringParameter(this, `/musical/${branch}/PaymentDomain`)

const cert = new Certificate(this, 'Certificate', {
  domainName: domainName,
})

When I try to run cdk synth or cdk deploy I get an error When using Tokens for domain names, ‘validationDomains’ needs to be supplied

I tried to add validationDomains to the certificate request but not only is this property depreciated I also don’t know how to specify the validation domain. It has a typescript format that I don’t understand:

CertificateProps.validationDomains?: {
  [domainName: string]: string;
}

Since validationDomains is depreciated, the docs say I should use validation but when I try to use validation the docs say that should be used for the validation method (DNS or email)

How do I create a correct certificate request when I use a token for a domain name?

Leave a Reply

Your email address will not be published. Required fields are marked *