diff --git a/.changeset/grumpy-hairs-run.md b/.changeset/grumpy-hairs-run.md new file mode 100644 index 00000000..1b77c5cd --- /dev/null +++ b/.changeset/grumpy-hairs-run.md @@ -0,0 +1,5 @@ +--- +"@codedazur/cdk-site-distribution": patch +--- + +Alias records now have unique resource IDs. diff --git a/packages/cdk-site-distribution/src/constructs/SiteDistribution.ts b/packages/cdk-site-distribution/src/constructs/SiteDistribution.ts index 3df25ded..e8bfd86b 100644 --- a/packages/cdk-site-distribution/src/constructs/SiteDistribution.ts +++ b/packages/cdk-site-distribution/src/constructs/SiteDistribution.ts @@ -204,9 +204,7 @@ export class SiteDistribution extends Construct { [subdomain, name].filter(Boolean).join("."), ); - for (const domain in domains) { - new CfnOutput(this, "URL", { value: "https://" + domain }); - } + new CfnOutput(this, "URL", { value: "https://" + domains[0] }); return domains; } @@ -524,7 +522,7 @@ export class SiteDistribution extends Construct { return domains.map( (domain) => - new ARecord(this, "DomainAlias", { + new ARecord(this, `DomainAlias-${domain}`, { recordName: domain, target: RecordTarget.fromAlias( new CloudFrontTarget(this.distribution),