@jaypie/constructs 1.2.40 → 1.2.42

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.
@@ -6,6 +6,15 @@ import * as route53 from "aws-cdk-lib/aws-route53";
6
6
  import { HostConfig } from "./helpers";
7
7
  export interface JaypieApiGatewayProps extends apiGateway.LambdaRestApiProps {
8
8
  certificate?: boolean | acm.ICertificate;
9
+ /**
10
+ * Force-delete any existing Route53 A record with the same name before
11
+ * creating the alias record. Useful when migrating from another construct
12
+ * (e.g., JaypieDistribution) that already owns the same hostname, where the
13
+ * default CloudFormation create-before-delete ordering would otherwise
14
+ * collide on the record name.
15
+ * @default false
16
+ */
17
+ deleteExistingRecord?: boolean;
9
18
  /**
10
19
  * The domain name for the API Gateway.
11
20
  *
@@ -66,6 +66,15 @@ export interface JaypieDistributionProps extends Omit<cloudfront.DistributionPro
66
66
  * Override default behavior (optional if handler is provided)
67
67
  */
68
68
  defaultBehavior?: cloudfront.BehaviorOptions;
69
+ /**
70
+ * Force-delete any existing Route53 A and AAAA records with the same name
71
+ * before creating the alias records. Useful when migrating from another
72
+ * construct (e.g., JaypieApiGateway) that already owns the same hostname,
73
+ * where the default CloudFormation create-before-delete ordering would
74
+ * otherwise collide on the record name.
75
+ * @default false
76
+ */
77
+ deleteExistingRecord?: boolean;
69
78
  /**
70
79
  * Log destination configuration for CloudFront access logs
71
80
  * - LambdaDestination: Use a specific Lambda destination for S3 notifications
package/dist/esm/index.js CHANGED
@@ -1134,7 +1134,7 @@ function clearAllSecretsCaches() {
1134
1134
  class JaypieApiGateway extends Construct {
1135
1135
  constructor(scope, id, props) {
1136
1136
  super(scope, id);
1137
- const { certificate = true, handler, host: propsHost, name, roleTag = CDK$2.ROLE.API, zone: propsZone, } = props;
1137
+ const { certificate = true, deleteExistingRecord = false, handler, host: propsHost, name, roleTag = CDK$2.ROLE.API, zone: propsZone, } = props;
1138
1138
  // Determine zone from props or environment
1139
1139
  let zone = propsZone;
1140
1140
  if (!zone && process.env.CDK_ENV_API_HOSTED_ZONE) {
@@ -1180,7 +1180,7 @@ class JaypieApiGateway extends Construct {
1180
1180
  // * `...lambdaRestApiProps` cannot be moved to the first const destructuring because it needs to exclude the custom properties first.
1181
1181
  // Ignore the variables we already assigned to other properties
1182
1182
  /* eslint-disable @typescript-eslint/no-unused-vars */
1183
- certificate: _certificate, host: _host, name: _name, roleTag: _roleTag, zone: _zone, handler: _handler,
1183
+ certificate: _certificate, deleteExistingRecord: _deleteExistingRecord, host: _host, name: _name, roleTag: _roleTag, zone: _zone, handler: _handler,
1184
1184
  /* eslint-enable @typescript-eslint/no-unused-vars */
1185
1185
  ...lambdaRestApiProps } = props;
1186
1186
  this._api = new apiGateway.LambdaRestApi(this, apiGatewayName, {
@@ -1195,6 +1195,7 @@ class JaypieApiGateway extends Construct {
1195
1195
  });
1196
1196
  Tags.of(this._domainName).add(CDK$2.TAG.ROLE, roleTag);
1197
1197
  const record = new route53.ARecord(this, "AliasRecord", {
1198
+ deleteExisting: deleteExistingRecord,
1198
1199
  recordName: host,
1199
1200
  target: route53.RecordTarget.fromAlias(new route53Targets.ApiGatewayDomain(this._domainName)),
1200
1201
  zone: hostedZone,
@@ -2358,7 +2359,7 @@ const DEFAULT_MANAGED_RULES = [
2358
2359
  class JaypieDistribution extends Construct {
2359
2360
  constructor(scope, id, props) {
2360
2361
  super(scope, id);
2361
- const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = Duration.seconds(CDK$2.DURATION.CLOUDFRONT_API), responseHeadersPolicy: responseHeadersPolicyProp, roleTag = CDK$2.ROLE.API, securityHeaders: securityHeadersProp, streaming = false, waf: wafProp = true, zone: propsZone, ...distributionProps } = props;
2362
+ const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, deleteExistingRecord = false, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = Duration.seconds(CDK$2.DURATION.CLOUDFRONT_API), responseHeadersPolicy: responseHeadersPolicyProp, roleTag = CDK$2.ROLE.API, securityHeaders: securityHeadersProp, streaming = false, waf: wafProp = true, zone: propsZone, ...distributionProps } = props;
2362
2363
  // Validate environment variables
2363
2364
  if (process.env.CDK_ENV_API_SUBDOMAIN &&
2364
2365
  !isValidSubdomain(process.env.CDK_ENV_API_SUBDOMAIN)) {
@@ -2718,12 +2719,14 @@ class JaypieDistribution extends Construct {
2718
2719
  // Create DNS records if we have host and zone
2719
2720
  if (host && hostedZone) {
2720
2721
  const aRecord = new route53.ARecord(this, "AliasRecord", {
2722
+ deleteExisting: deleteExistingRecord,
2721
2723
  recordName: host,
2722
2724
  target: route53.RecordTarget.fromAlias(new route53Targets.CloudFrontTarget(this.distribution)),
2723
2725
  zone: hostedZone,
2724
2726
  });
2725
2727
  Tags.of(aRecord).add(CDK$2.TAG.ROLE, CDK$2.ROLE.NETWORKING);
2726
2728
  const aaaaRecord = new route53.AaaaRecord(this, "AaaaAliasRecord", {
2729
+ deleteExisting: deleteExistingRecord,
2727
2730
  recordName: host,
2728
2731
  target: route53.RecordTarget.fromAlias(new route53Targets.CloudFrontTarget(this.distribution)),
2729
2732
  zone: hostedZone,
@@ -3919,6 +3922,7 @@ class JaypieSsoPermissions extends Construct {
3919
3922
  "dynamodb:*",
3920
3923
  "ec2:*",
3921
3924
  "ecr:*",
3925
+ "ecs:*",
3922
3926
  "iam:Get*",
3923
3927
  "iam:List*",
3924
3928
  "iam:PassRole",