@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
@@ -1170,7 +1170,7 @@ function clearAllSecretsCaches() {
1170
1170
  class JaypieApiGateway extends constructs.Construct {
1171
1171
  constructor(scope, id, props) {
1172
1172
  super(scope, id);
1173
- const { certificate = true, handler, host: propsHost, name, roleTag = CDK$2.ROLE.API, zone: propsZone, } = props;
1173
+ const { certificate = true, deleteExistingRecord = false, handler, host: propsHost, name, roleTag = CDK$2.ROLE.API, zone: propsZone, } = props;
1174
1174
  // Determine zone from props or environment
1175
1175
  let zone = propsZone;
1176
1176
  if (!zone && process.env.CDK_ENV_API_HOSTED_ZONE) {
@@ -1216,7 +1216,7 @@ class JaypieApiGateway extends constructs.Construct {
1216
1216
  // * `...lambdaRestApiProps` cannot be moved to the first const destructuring because it needs to exclude the custom properties first.
1217
1217
  // Ignore the variables we already assigned to other properties
1218
1218
  /* eslint-disable @typescript-eslint/no-unused-vars */
1219
- certificate: _certificate, host: _host, name: _name, roleTag: _roleTag, zone: _zone, handler: _handler,
1219
+ certificate: _certificate, deleteExistingRecord: _deleteExistingRecord, host: _host, name: _name, roleTag: _roleTag, zone: _zone, handler: _handler,
1220
1220
  /* eslint-enable @typescript-eslint/no-unused-vars */
1221
1221
  ...lambdaRestApiProps } = props;
1222
1222
  this._api = new apiGateway__namespace.LambdaRestApi(this, apiGatewayName, {
@@ -1231,6 +1231,7 @@ class JaypieApiGateway extends constructs.Construct {
1231
1231
  });
1232
1232
  cdk.Tags.of(this._domainName).add(CDK$2.TAG.ROLE, roleTag);
1233
1233
  const record = new route53__namespace.ARecord(this, "AliasRecord", {
1234
+ deleteExisting: deleteExistingRecord,
1234
1235
  recordName: host,
1235
1236
  target: route53__namespace.RecordTarget.fromAlias(new route53Targets__namespace.ApiGatewayDomain(this._domainName)),
1236
1237
  zone: hostedZone,
@@ -2394,7 +2395,7 @@ const DEFAULT_MANAGED_RULES = [
2394
2395
  class JaypieDistribution extends constructs.Construct {
2395
2396
  constructor(scope, id, props) {
2396
2397
  super(scope, id);
2397
- const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = cdk.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;
2398
+ const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, deleteExistingRecord = false, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = cdk.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;
2398
2399
  // Validate environment variables
2399
2400
  if (process.env.CDK_ENV_API_SUBDOMAIN &&
2400
2401
  !isValidSubdomain(process.env.CDK_ENV_API_SUBDOMAIN)) {
@@ -2754,12 +2755,14 @@ class JaypieDistribution extends constructs.Construct {
2754
2755
  // Create DNS records if we have host and zone
2755
2756
  if (host && hostedZone) {
2756
2757
  const aRecord = new route53__namespace.ARecord(this, "AliasRecord", {
2758
+ deleteExisting: deleteExistingRecord,
2757
2759
  recordName: host,
2758
2760
  target: route53__namespace.RecordTarget.fromAlias(new route53Targets__namespace.CloudFrontTarget(this.distribution)),
2759
2761
  zone: hostedZone,
2760
2762
  });
2761
2763
  cdk.Tags.of(aRecord).add(CDK$2.TAG.ROLE, CDK$2.ROLE.NETWORKING);
2762
2764
  const aaaaRecord = new route53__namespace.AaaaRecord(this, "AaaaAliasRecord", {
2765
+ deleteExisting: deleteExistingRecord,
2763
2766
  recordName: host,
2764
2767
  target: route53__namespace.RecordTarget.fromAlias(new route53Targets__namespace.CloudFrontTarget(this.distribution)),
2765
2768
  zone: hostedZone,
@@ -3955,6 +3958,7 @@ class JaypieSsoPermissions extends constructs.Construct {
3955
3958
  "dynamodb:*",
3956
3959
  "ec2:*",
3957
3960
  "ecr:*",
3961
+ "ecs:*",
3958
3962
  "iam:Get*",
3959
3963
  "iam:List*",
3960
3964
  "iam:PassRole",