Description
Using PublicCertificate with DNS validation and a domainName obtained from DnsZone.fromZoneId() causes synthesis to abort with the error:
Error: You cannot use a token (e.g., a reference to an attribute) as the id of a construct.
Ids of constructs must be known at synthesis time, and token values are only known when
Terraform runs. Please use a concrete value for your construct's ID instead.
You passed the following id: "ValidationRecord-${TfToken[TOKEN.1195]}"
The failure stems from the construct building a RecordSet like
new RecordSet(this, \ValidationRecord-${domainName}`, …)`.
ref: https://github.com/TerraConstructs/base/blob/main/src/aws/edge/certificate.ts#L255
Steps to Reproduce:
const albZone = DnsZone.fromZoneId(this, `alb-zone`, props.appHostedZoneId);
const cert = new PublicCertificate(this, 'cert', {
domainName: albZone.zoneName,
validation: {
method: ValidationMethod.DNS,
hostedZone: albZone,
},
});
``
Assumption:
When I am using the **DnsZone.fromZoneId**, the domainName/zoneName is a token during synth.
The interpolated ID itself becomes a token, which the CDK/Terraform adapter rejects.