@openhi/constructs 0.0.123 → 0.0.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.mts CHANGED
@@ -1133,7 +1133,11 @@ interface StaticHostingProps {
1133
1133
  readonly hostedZone?: IHostedZone;
1134
1134
  /**
1135
1135
  * Domain names to attach to the CloudFront distribution. Each name also
1136
- * gets an ARecord in `hostedZone`.
1136
+ * gets an ARecord in `hostedZone`, except for wildcard entries
1137
+ * (e.g. `*.dev.openhi.org`) which are added as CloudFront alternate
1138
+ * domain names (so the cert covers them) but skipped by the ARecord
1139
+ * loop — Route53 cannot create an `A` record at a wildcard apex, and
1140
+ * per-host ARecords are created later by downstream stacks.
1137
1141
  */
1138
1142
  readonly domainNames?: ReadonlyArray<string>;
1139
1143
  /**
@@ -1216,6 +1220,12 @@ declare class StaticHosting extends Construct {
1216
1220
  * SSM parameter name for the CloudFront distribution ID.
1217
1221
  */
1218
1222
  static readonly SSM_PARAM_NAME_DISTRIBUTION_ID = "STATIC_HOSTING_DISTRIBUTION_ID";
1223
+ /**
1224
+ * Returns true when `domainName` begins with a wildcard label (`*.`),
1225
+ * indicating it is an alt-name on the CloudFront cert but cannot be
1226
+ * created as a Route53 ARecord.
1227
+ */
1228
+ private static isWildcardDomain;
1219
1229
  readonly bucket: IBucket;
1220
1230
  readonly distribution: Distribution;
1221
1231
  readonly viewerRequestHandler: NodejsFunction;
package/lib/index.d.ts CHANGED
@@ -1770,7 +1770,11 @@ interface StaticHostingProps {
1770
1770
  readonly hostedZone?: IHostedZone;
1771
1771
  /**
1772
1772
  * Domain names to attach to the CloudFront distribution. Each name also
1773
- * gets an ARecord in `hostedZone`.
1773
+ * gets an ARecord in `hostedZone`, except for wildcard entries
1774
+ * (e.g. `*.dev.openhi.org`) which are added as CloudFront alternate
1775
+ * domain names (so the cert covers them) but skipped by the ARecord
1776
+ * loop — Route53 cannot create an `A` record at a wildcard apex, and
1777
+ * per-host ARecords are created later by downstream stacks.
1774
1778
  */
1775
1779
  readonly domainNames?: ReadonlyArray<string>;
1776
1780
  /**
@@ -1853,6 +1857,12 @@ declare class StaticHosting extends Construct {
1853
1857
  * SSM parameter name for the CloudFront distribution ID.
1854
1858
  */
1855
1859
  static readonly SSM_PARAM_NAME_DISTRIBUTION_ID = "STATIC_HOSTING_DISTRIBUTION_ID";
1860
+ /**
1861
+ * Returns true when `domainName` begins with a wildcard label (`*.`),
1862
+ * indicating it is an alt-name on the CloudFront cert but cannot be
1863
+ * created as a Route53 ARecord.
1864
+ */
1865
+ private static isWildcardDomain;
1856
1866
  readonly bucket: IBucket;
1857
1867
  readonly distribution: Distribution;
1858
1868
  readonly viewerRequestHandler: NodejsFunction;
package/lib/index.js CHANGED
@@ -2374,6 +2374,14 @@ var import_aws_s3 = require("aws-cdk-lib/aws-s3");
2374
2374
  var import_constructs9 = require("constructs");
2375
2375
  var STATIC_HOSTING_SERVICE_TYPE = "website";
2376
2376
  var _StaticHosting = class _StaticHosting extends import_constructs9.Construct {
2377
+ /**
2378
+ * Returns true when `domainName` begins with a wildcard label (`*.`),
2379
+ * indicating it is an alt-name on the CloudFront cert but cannot be
2380
+ * created as a Route53 ARecord.
2381
+ */
2382
+ static isWildcardDomain(domainName) {
2383
+ return domainName.startsWith("*.");
2384
+ }
2377
2385
  constructor(scope, id, props = {}) {
2378
2386
  super(scope, id);
2379
2387
  const stack = OpenHiService.of(scope);
@@ -2460,6 +2468,9 @@ var _StaticHosting = class _StaticHosting extends import_constructs9.Construct {
2460
2468
  });
2461
2469
  if (hasCustomDomain) {
2462
2470
  props.domainNames.forEach((domainName, index) => {
2471
+ if (_StaticHosting.isWildcardDomain(domainName)) {
2472
+ return;
2473
+ }
2463
2474
  new import_aws_route532.ARecord(this, `dns-record-${index}`, {
2464
2475
  zone: props.hostedZone,
2465
2476
  recordName: domainName,