@jaypie/constructs 1.2.66 → 1.2.68

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.
@@ -213,6 +213,19 @@ export interface JaypieDistributionProps extends Omit<cloudfront.DistributionPro
213
213
  * @default CDK.ROLE.HOSTING
214
214
  */
215
215
  roleTag?: string;
216
+ /**
217
+ * Service tag for attributing this distribution to a service (parallel to
218
+ * `roleTag`, matching `JaypieLambda`). When set, the distribution is tagged
219
+ * with `CDK.TAG.SERVICE` (so metrics carry `service:<value>` instead of
220
+ * `service:N/A`) and the created access-log and WAF-log buckets are tagged
221
+ * with the same value, so the Datadog forwarder attributes their forwarded
222
+ * logs to the service instead of the generic `cloudfront`/source default.
223
+ *
224
+ * Omit to preserve current behavior (no service tag). Has no effect on
225
+ * external/imported log buckets, which this construct does not own.
226
+ * @default undefined (no service tag)
227
+ */
228
+ serviceTag?: string;
216
229
  /**
217
230
  * WAF WebACL configuration for the CloudFront distribution.
218
231
  * - true/undefined: create and attach a WebACL with sensible defaults
@@ -23,6 +23,7 @@ export interface ExtendDatadogRoleOptions {
23
23
  * If found, creates a custom policy with:
24
24
  * - budgets:ViewBudget
25
25
  * - logs:DescribeLogGroups
26
+ * - trustedadvisor:ListRecommendations
26
27
  *
27
28
  * @param scope - The construct scope
28
29
  * @param options - Configuration options
@@ -465,6 +465,7 @@ function envHostname({ component, domain, env, subdomain, } = {}) {
465
465
  * If found, creates a custom policy with:
466
466
  * - budgets:ViewBudget
467
467
  * - logs:DescribeLogGroups
468
+ * - trustedadvisor:ListRecommendations
468
469
  *
469
470
  * @param scope - The construct scope
470
471
  * @param options - Configuration options
@@ -491,6 +492,11 @@ function extendDatadogRole(scope, options) {
491
492
  actions: ["logs:DescribeLogGroups"],
492
493
  resources: ["*"],
493
494
  }),
495
+ // Allow list trusted advisor recommendations
496
+ new iam.PolicyStatement({
497
+ actions: ["trustedadvisor:ListRecommendations"],
498
+ resources: ["*"],
499
+ }),
494
500
  ];
495
501
  // Create the custom policy
496
502
  const datadogCustomPolicy = new iam.Policy(scope, id, {
@@ -2708,7 +2714,7 @@ const DEFAULT_MANAGED_RULES$1 = [
2708
2714
  class JaypieDistribution extends constructs.Construct {
2709
2715
  constructor(scope, id, props) {
2710
2716
  super(scope, id);
2711
- 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;
2717
+ 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, serviceTag, streaming = false, waf: wafProp = true, zone: propsZone, ...distributionProps } = props;
2712
2718
  // Validate environment variables
2713
2719
  if (process.env.CDK_ENV_API_SUBDOMAIN &&
2714
2720
  !isValidSubdomain(process.env.CDK_ENV_API_SUBDOMAIN)) {
@@ -2917,6 +2923,9 @@ class JaypieDistribution extends constructs.Construct {
2917
2923
  removalPolicy: cdk.RemovalPolicy.DESTROY,
2918
2924
  });
2919
2925
  cdk.Tags.of(createdBucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.STORAGE);
2926
+ if (serviceTag) {
2927
+ cdk.Tags.of(createdBucket).add(CDK$2.TAG.SERVICE, serviceTag);
2928
+ }
2920
2929
  logBucket = createdBucket;
2921
2930
  }
2922
2931
  // Add S3 notifications if we have a bucket and destination is not false
@@ -2947,6 +2956,9 @@ class JaypieDistribution extends constructs.Construct {
2947
2956
  ...distributionProps,
2948
2957
  });
2949
2958
  cdk.Tags.of(this.distribution).add(CDK$2.TAG.ROLE, roleTag);
2959
+ if (serviceTag) {
2960
+ cdk.Tags.of(this.distribution).add(CDK$2.TAG.SERVICE, serviceTag);
2961
+ }
2950
2962
  this.distributionArn = `arn:aws:cloudfront::${cdk.Stack.of(this).account}:distribution/${this.distribution.distributionId}`;
2951
2963
  this.distributionDomainName = this.distribution.distributionDomainName;
2952
2964
  this.distributionId = this.distribution.distributionId;
@@ -3151,6 +3163,9 @@ class JaypieDistribution extends constructs.Construct {
3151
3163
  removalPolicy: cdk.RemovalPolicy.RETAIN,
3152
3164
  });
3153
3165
  cdk.Tags.of(createdBucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.MONITORING);
3166
+ if (serviceTag) {
3167
+ cdk.Tags.of(createdBucket).add(CDK$2.TAG.SERVICE, serviceTag);
3168
+ }
3154
3169
  // Add Datadog forwarder notification
3155
3170
  if (destinationProp !== false) {
3156
3171
  const lambdaDestination = destinationProp === true