@go-to-k/cdkd 0.50.11 → 0.50.13

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/dist/cli.js CHANGED
@@ -12008,11 +12008,11 @@ var S3BucketProvider = class {
12008
12008
  this.logger.debug(`Applied EventBridge notification to bucket ${bucketName}`);
12009
12009
  }
12010
12010
  const corsConfig = properties["CorsConfiguration"];
12011
- if (corsConfig?.CorsRules) {
12011
+ if (corsConfig?.CorsRules && Array.isArray(corsConfig.CorsRules) && corsConfig.CorsRules.length > 0) {
12012
12012
  await this.applyCorsConfiguration(bucketName, corsConfig);
12013
12013
  }
12014
12014
  const lifecycleConfig = properties["LifecycleConfiguration"];
12015
- if (lifecycleConfig?.Rules) {
12015
+ if (lifecycleConfig?.Rules && Array.isArray(lifecycleConfig.Rules) && lifecycleConfig.Rules.length > 0) {
12016
12016
  await this.applyLifecycleConfiguration(bucketName, lifecycleConfig);
12017
12017
  }
12018
12018
  const publicAccessBlock = properties["PublicAccessBlockConfiguration"];
@@ -12020,7 +12020,7 @@ var S3BucketProvider = class {
12020
12020
  await this.applyPublicAccessBlockConfiguration(bucketName, publicAccessBlock);
12021
12021
  }
12022
12022
  const bucketEncryption = properties["BucketEncryption"];
12023
- if (bucketEncryption?.ServerSideEncryptionConfiguration) {
12023
+ if (bucketEncryption?.ServerSideEncryptionConfiguration && Array.isArray(bucketEncryption.ServerSideEncryptionConfiguration) && bucketEncryption.ServerSideEncryptionConfiguration.length > 0) {
12024
12024
  await this.applyBucketEncryption(bucketName, bucketEncryption);
12025
12025
  }
12026
12026
  const loggingConfig = properties["LoggingConfiguration"];
@@ -12281,11 +12281,12 @@ var S3BucketProvider = class {
12281
12281
  }
12282
12282
  try {
12283
12283
  const resp = await this.s3Client.send(new GetBucketTaggingCommand({ Bucket: physicalId }));
12284
- const tags = normalizeAwsTagsToCfn(resp.TagSet);
12285
- result["Tags"] = tags;
12284
+ result["Tags"] = normalizeAwsTagsToCfn(resp.TagSet);
12286
12285
  } catch (err) {
12287
12286
  const e = err;
12288
- if (e.name !== "NoSuchTagSet") {
12287
+ if (e.name === "NoSuchTagSet") {
12288
+ result["Tags"] = [];
12289
+ } else {
12289
12290
  throw err;
12290
12291
  }
12291
12292
  }
@@ -13838,7 +13839,7 @@ var SNSSubscriptionProvider = class {
13838
13839
  try {
13839
13840
  const attributes = {};
13840
13841
  const filterPolicy = properties["FilterPolicy"];
13841
- if (filterPolicy) {
13842
+ if (filterPolicy !== void 0) {
13842
13843
  attributes["FilterPolicy"] = typeof filterPolicy === "string" ? filterPolicy : JSON.stringify(filterPolicy);
13843
13844
  }
13844
13845
  const response = await this.snsClient.send(
@@ -17107,6 +17108,19 @@ var LogsLogGroupProvider = class {
17107
17108
  }
17108
17109
  return this.buildArn(physicalId);
17109
17110
  }
17111
+ /**
17112
+ * Drift comparator skip-list: properties readCurrentState deliberately
17113
+ * cannot round-trip from AWS yet. `DataProtectionPolicy` lives behind
17114
+ * its own `GetDataProtectionPolicy` API call (not in
17115
+ * `DescribeLogGroups` output) — declaring it here prevents
17116
+ * guaranteed false-positive drift on every clean run for log groups
17117
+ * deployed with a data-protection policy. Lifting this guard requires
17118
+ * a per-group `GetDataProtectionPolicy` round-trip in
17119
+ * `readCurrentState`.
17120
+ */
17121
+ getDriftUnknownPaths() {
17122
+ return ["DataProtectionPolicy"];
17123
+ }
17110
17124
  /**
17111
17125
  * Read the AWS-current log group configuration in CFn-property shape.
17112
17126
  *
@@ -17141,25 +17155,24 @@ var LogsLogGroupProvider = class {
17141
17155
  if (found.logGroupName !== void 0)
17142
17156
  result["LogGroupName"] = found.logGroupName;
17143
17157
  result["KmsKeyId"] = found.kmsKeyId ?? "";
17144
- if (found.retentionInDays !== void 0) {
17145
- result["RetentionInDays"] = found.retentionInDays;
17146
- }
17158
+ result["RetentionInDays"] = found.retentionInDays ?? 0;
17147
17159
  if (found.logGroupClass !== void 0)
17148
17160
  result["LogGroupClass"] = found.logGroupClass;
17161
+ let tags = [];
17149
17162
  if (found.arn) {
17150
17163
  const arnForTags = found.arn.replace(/:\*$/, "");
17151
17164
  try {
17152
17165
  const tagsResp = await this.logsClient.send(
17153
17166
  new ListTagsForResourceCommand2({ resourceArn: arnForTags })
17154
17167
  );
17155
- const tags = normalizeAwsTagsToCfn(tagsResp.tags);
17156
- result["Tags"] = tags;
17168
+ tags = normalizeAwsTagsToCfn(tagsResp.tags);
17157
17169
  } catch (err) {
17158
17170
  if (err instanceof ResourceNotFoundException7)
17159
17171
  return void 0;
17160
17172
  throw err;
17161
17173
  }
17162
17174
  }
17175
+ result["Tags"] = tags;
17163
17176
  return result;
17164
17177
  } catch (err) {
17165
17178
  if (err instanceof ResourceNotFoundException7)
@@ -17439,6 +17452,7 @@ var CloudWatchAlarmProvider = class {
17439
17452
  * Build PutMetricAlarm parameters from CDK properties
17440
17453
  */
17441
17454
  buildAlarmParams(alarmName, properties) {
17455
+ const emptyToUndefined = (v) => typeof v === "string" && v === "" ? void 0 : v;
17442
17456
  const params = {
17443
17457
  AlarmName: alarmName,
17444
17458
  ComparisonOperator: properties["ComparisonOperator"],
@@ -17446,15 +17460,16 @@ var CloudWatchAlarmProvider = class {
17446
17460
  Threshold: properties["Threshold"],
17447
17461
  ActionsEnabled: properties["ActionsEnabled"],
17448
17462
  AlarmActions: properties["AlarmActions"],
17449
- AlarmDescription: properties["AlarmDescription"],
17463
+ AlarmDescription: emptyToUndefined(properties["AlarmDescription"]),
17450
17464
  DatapointsToAlarm: properties["DatapointsToAlarm"],
17451
17465
  InsufficientDataActions: properties["InsufficientDataActions"],
17452
17466
  OKActions: properties["OKActions"],
17453
- TreatMissingData: properties["TreatMissingData"],
17454
- Unit: properties["Unit"]
17467
+ TreatMissingData: emptyToUndefined(properties["TreatMissingData"]),
17468
+ Unit: emptyToUndefined(properties["Unit"])
17455
17469
  };
17456
- if (properties["Metrics"]) {
17457
- const metrics = properties["Metrics"];
17470
+ const metricsValue = properties["Metrics"];
17471
+ if (Array.isArray(metricsValue) && metricsValue.length > 0) {
17472
+ const metrics = metricsValue;
17458
17473
  params["Metrics"] = metrics.map((m) => {
17459
17474
  const entry = {
17460
17475
  Id: m["Id"]
@@ -17484,10 +17499,10 @@ var CloudWatchAlarmProvider = class {
17484
17499
  return entry;
17485
17500
  });
17486
17501
  } else {
17487
- params["MetricName"] = properties["MetricName"];
17488
- params["Namespace"] = properties["Namespace"];
17502
+ params["MetricName"] = emptyToUndefined(properties["MetricName"]);
17503
+ params["Namespace"] = emptyToUndefined(properties["Namespace"]);
17489
17504
  params["Period"] = properties["Period"];
17490
- params["Statistic"] = properties["Statistic"];
17505
+ params["Statistic"] = emptyToUndefined(properties["Statistic"]);
17491
17506
  params["Dimensions"] = properties["Dimensions"];
17492
17507
  }
17493
17508
  return params;
@@ -18123,19 +18138,21 @@ var SSMParameterProvider = class {
18123
18138
  Name: physicalId,
18124
18139
  Type: type,
18125
18140
  Value: value,
18126
- Description: properties["Description"],
18127
18141
  Overwrite: true
18128
18142
  };
18129
- if (properties["AllowedPattern"]) {
18143
+ if (properties["Description"] !== void 0) {
18144
+ putParams.Description = properties["Description"];
18145
+ }
18146
+ if (properties["AllowedPattern"] !== void 0) {
18130
18147
  putParams.AllowedPattern = properties["AllowedPattern"];
18131
18148
  }
18132
- if (properties["Tier"]) {
18149
+ if (properties["Tier"] !== void 0) {
18133
18150
  putParams.Tier = properties["Tier"];
18134
18151
  }
18135
- if (properties["Policies"]) {
18152
+ if (properties["Policies"] !== void 0) {
18136
18153
  putParams.Policies = properties["Policies"];
18137
18154
  }
18138
- if (properties["DataType"]) {
18155
+ if (properties["DataType"] !== void 0) {
18139
18156
  putParams.DataType = properties["DataType"];
18140
18157
  }
18141
18158
  await this.ssmClient.send(new PutParameterCommand(putParams));
@@ -18829,6 +18846,16 @@ import {
18829
18846
  ResourceNotFoundException as ResourceNotFoundException10
18830
18847
  } from "@aws-sdk/client-eventbridge";
18831
18848
  init_aws_clients();
18849
+ function sanitizeDeadLetterConfig(value) {
18850
+ if (value === null || value === void 0)
18851
+ return void 0;
18852
+ if (typeof value !== "object")
18853
+ return void 0;
18854
+ const arn = value["Arn"];
18855
+ if (typeof arn !== "string" || arn.length === 0)
18856
+ return void 0;
18857
+ return { Arn: arn };
18858
+ }
18832
18859
  var EventBridgeBusProvider = class {
18833
18860
  eventBridgeClient;
18834
18861
  logger = getLogger().child("EventBridgeBusProvider");
@@ -18875,11 +18902,9 @@ var EventBridgeBusProvider = class {
18875
18902
  if (properties["Tags"]) {
18876
18903
  createParams.Tags = properties["Tags"];
18877
18904
  }
18878
- if (properties["DeadLetterConfig"]) {
18879
- const dlcConfig = properties["DeadLetterConfig"];
18880
- createParams.DeadLetterConfig = {
18881
- Arn: dlcConfig["Arn"]
18882
- };
18905
+ const dlcCreate = sanitizeDeadLetterConfig(properties["DeadLetterConfig"]);
18906
+ if (dlcCreate) {
18907
+ createParams.DeadLetterConfig = dlcCreate;
18883
18908
  }
18884
18909
  const response = await this.eventBridgeClient.send(new CreateEventBusCommand(createParams));
18885
18910
  const eventBusArn = response.EventBusArn ?? "";
@@ -18918,11 +18943,11 @@ var EventBridgeBusProvider = class {
18918
18943
  if (properties["KmsKeyIdentifier"] !== void 0) {
18919
18944
  updateParams.KmsKeyIdentifier = properties["KmsKeyIdentifier"];
18920
18945
  }
18921
- if (properties["DeadLetterConfig"]) {
18922
- const dlcConfig = properties["DeadLetterConfig"];
18923
- updateParams.DeadLetterConfig = {
18924
- Arn: dlcConfig["Arn"]
18925
- };
18946
+ if (properties["DeadLetterConfig"] !== void 0) {
18947
+ const dlcUpdate = sanitizeDeadLetterConfig(properties["DeadLetterConfig"]);
18948
+ if (dlcUpdate) {
18949
+ updateParams.DeadLetterConfig = dlcUpdate;
18950
+ }
18926
18951
  }
18927
18952
  await this.eventBridgeClient.send(new UpdateEventBusCommand(updateParams));
18928
18953
  }
@@ -24889,22 +24914,18 @@ var StepFunctionsProvider = class {
24889
24914
  const tagList = properties["Tags"];
24890
24915
  tags = tagList.map((tag) => ({ key: tag.Key, value: tag.Value }));
24891
24916
  }
24892
- const cfnEncConfig = properties["EncryptionConfiguration"];
24893
- let encryptionConfiguration;
24894
- if (cfnEncConfig) {
24895
- encryptionConfiguration = {
24896
- type: cfnEncConfig["Type"],
24897
- kmsKeyId: cfnEncConfig["KmsKeyId"],
24898
- kmsDataKeyReusePeriodSeconds: cfnEncConfig["KmsDataKeyReusePeriodSeconds"]
24899
- };
24900
- }
24917
+ const encryptionConfiguration = mapEncryptionConfiguration(
24918
+ properties["EncryptionConfiguration"]
24919
+ );
24920
+ const loggingConfiguration = mapLoggingConfiguration(properties["LoggingConfiguration"]);
24921
+ const tracingConfiguration = mapTracingConfiguration(properties["TracingConfiguration"]);
24901
24922
  const createParams = {
24902
24923
  name: stateMachineName,
24903
24924
  definition: definitionString,
24904
24925
  roleArn,
24905
24926
  type: properties["StateMachineType"],
24906
- loggingConfiguration: properties["LoggingConfiguration"],
24907
- tracingConfiguration: properties["TracingConfiguration"],
24927
+ loggingConfiguration,
24928
+ tracingConfiguration,
24908
24929
  tags,
24909
24930
  encryptionConfiguration
24910
24931
  };
@@ -24945,22 +24966,18 @@ var StepFunctionsProvider = class {
24945
24966
  this.logger.debug(`Updating Step Functions state machine ${logicalId}: ${physicalId}`);
24946
24967
  try {
24947
24968
  const definitionString = this.buildDefinitionString(properties);
24948
- const cfnEncConfig = properties["EncryptionConfiguration"];
24949
- let encryptionConfiguration;
24950
- if (cfnEncConfig) {
24951
- encryptionConfiguration = {
24952
- type: cfnEncConfig["Type"],
24953
- kmsKeyId: cfnEncConfig["KmsKeyId"],
24954
- kmsDataKeyReusePeriodSeconds: cfnEncConfig["KmsDataKeyReusePeriodSeconds"]
24955
- };
24956
- }
24969
+ const encryptionConfiguration = mapEncryptionConfiguration(
24970
+ properties["EncryptionConfiguration"]
24971
+ );
24972
+ const loggingConfiguration = mapLoggingConfiguration(properties["LoggingConfiguration"]);
24973
+ const tracingConfiguration = mapTracingConfiguration(properties["TracingConfiguration"]);
24957
24974
  await this.getClient().send(
24958
24975
  new UpdateStateMachineCommand({
24959
24976
  stateMachineArn: physicalId,
24960
24977
  definition: definitionString,
24961
24978
  roleArn: properties["RoleArn"],
24962
- loggingConfiguration: properties["LoggingConfiguration"],
24963
- tracingConfiguration: properties["TracingConfiguration"],
24979
+ loggingConfiguration,
24980
+ tracingConfiguration,
24964
24981
  encryptionConfiguration
24965
24982
  })
24966
24983
  );
@@ -25248,6 +25265,57 @@ var StepFunctionsProvider = class {
25248
25265
  return "{}";
25249
25266
  }
25250
25267
  };
25268
+ function mapEncryptionConfiguration(value) {
25269
+ if (value === null || value === void 0)
25270
+ return void 0;
25271
+ if (typeof value !== "object")
25272
+ return void 0;
25273
+ const cfg = value;
25274
+ if (cfg["Type"] === void 0)
25275
+ return void 0;
25276
+ return {
25277
+ type: cfg["Type"],
25278
+ kmsKeyId: cfg["KmsKeyId"],
25279
+ kmsDataKeyReusePeriodSeconds: cfg["KmsDataKeyReusePeriodSeconds"]
25280
+ };
25281
+ }
25282
+ function mapLoggingConfiguration(value) {
25283
+ if (value === null || value === void 0)
25284
+ return void 0;
25285
+ if (typeof value !== "object")
25286
+ return void 0;
25287
+ const cfg = value;
25288
+ if (cfg["Level"] === void 0)
25289
+ return void 0;
25290
+ const result = {
25291
+ level: cfg["Level"]
25292
+ };
25293
+ if (cfg["IncludeExecutionData"] !== void 0) {
25294
+ result.includeExecutionData = cfg["IncludeExecutionData"];
25295
+ }
25296
+ if (Array.isArray(cfg["Destinations"])) {
25297
+ result.destinations = cfg["Destinations"].map((d) => {
25298
+ const cwLogs = d["CloudWatchLogsLogGroup"];
25299
+ if (cwLogs?.["LogGroupArn"] !== void 0) {
25300
+ return {
25301
+ cloudWatchLogsLogGroup: { logGroupArn: cwLogs["LogGroupArn"] }
25302
+ };
25303
+ }
25304
+ return {};
25305
+ });
25306
+ }
25307
+ return result;
25308
+ }
25309
+ function mapTracingConfiguration(value) {
25310
+ if (value === null || value === void 0)
25311
+ return void 0;
25312
+ if (typeof value !== "object")
25313
+ return void 0;
25314
+ const cfg = value;
25315
+ if (cfg["Enabled"] === void 0)
25316
+ return void 0;
25317
+ return { enabled: cfg["Enabled"] };
25318
+ }
25251
25319
 
25252
25320
  // src/provisioning/providers/ecs-provider.ts
25253
25321
  import {
@@ -29043,6 +29111,13 @@ import {
29043
29111
  UntagResourceCommand as UntagResourceCommand13,
29044
29112
  WAFNonexistentItemException
29045
29113
  } from "@aws-sdk/client-wafv2";
29114
+ function sanitizeDescription(value) {
29115
+ if (value === void 0 || value === null)
29116
+ return void 0;
29117
+ if (typeof value === "string" && value.length === 0)
29118
+ return void 0;
29119
+ return value;
29120
+ }
29046
29121
  function parseWebACLArn(arn) {
29047
29122
  const parts = arn.split(":");
29048
29123
  const resourcePart = parts.slice(5).join(":");
@@ -29104,7 +29179,7 @@ var WAFv2WebACLProvider = class {
29104
29179
  Name: name,
29105
29180
  Scope: scope,
29106
29181
  DefaultAction: properties["DefaultAction"],
29107
- Description: properties["Description"],
29182
+ Description: sanitizeDescription(properties["Description"]),
29108
29183
  Rules: properties["Rules"] || [],
29109
29184
  VisibilityConfig: properties["VisibilityConfig"],
29110
29185
  ...tags.length > 0 && { Tags: tags },
@@ -29169,7 +29244,7 @@ var WAFv2WebACLProvider = class {
29169
29244
  Id: id,
29170
29245
  LockToken: lockToken,
29171
29246
  DefaultAction: properties["DefaultAction"],
29172
- Description: properties["Description"],
29247
+ Description: sanitizeDescription(properties["Description"]),
29173
29248
  Rules: properties["Rules"] || [],
29174
29249
  VisibilityConfig: properties["VisibilityConfig"],
29175
29250
  CustomResponseBodies: properties["CustomResponseBodies"],
@@ -29431,6 +29506,9 @@ import {
29431
29506
  ListTagsForResourceCommand as ListTagsForResourceCommand13,
29432
29507
  ResourceNotFoundException as ResourceNotFoundException12
29433
29508
  } from "@aws-sdk/client-cognito-identity-provider";
29509
+ function isEmptyObjectPlaceholder(value) {
29510
+ return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
29511
+ }
29434
29512
  var CognitoUserPoolProvider = class {
29435
29513
  cognitoClient;
29436
29514
  providerRegion = process.env["AWS_REGION"];
@@ -29632,7 +29710,7 @@ var CognitoUserPoolProvider = class {
29632
29710
  if (properties["EmailConfiguration"]) {
29633
29711
  updateParams.EmailConfiguration = properties["EmailConfiguration"];
29634
29712
  }
29635
- if (properties["SmsConfiguration"]) {
29713
+ if (properties["SmsConfiguration"] && !isEmptyObjectPlaceholder(properties["SmsConfiguration"])) {
29636
29714
  updateParams.SmsConfiguration = properties["SmsConfiguration"];
29637
29715
  }
29638
29716
  if (properties["VerificationMessageTemplate"]) {
@@ -29641,19 +29719,19 @@ var CognitoUserPoolProvider = class {
29641
29719
  if (properties["DeviceConfiguration"]) {
29642
29720
  updateParams.DeviceConfiguration = properties["DeviceConfiguration"];
29643
29721
  }
29644
- if (properties["UserPoolAddOns"]) {
29722
+ if (properties["UserPoolAddOns"] && !isEmptyObjectPlaceholder(properties["UserPoolAddOns"])) {
29645
29723
  updateParams.UserPoolAddOns = properties["UserPoolAddOns"];
29646
29724
  }
29647
- if (properties["EmailVerificationMessage"]) {
29725
+ if (properties["EmailVerificationMessage"] !== void 0) {
29648
29726
  updateParams.EmailVerificationMessage = properties["EmailVerificationMessage"];
29649
29727
  }
29650
- if (properties["EmailVerificationSubject"]) {
29728
+ if (properties["EmailVerificationSubject"] !== void 0) {
29651
29729
  updateParams.EmailVerificationSubject = properties["EmailVerificationSubject"];
29652
29730
  }
29653
- if (properties["SmsAuthenticationMessage"]) {
29731
+ if (properties["SmsAuthenticationMessage"] !== void 0) {
29654
29732
  updateParams.SmsAuthenticationMessage = properties["SmsAuthenticationMessage"];
29655
29733
  }
29656
- if (properties["SmsVerificationMessage"]) {
29734
+ if (properties["SmsVerificationMessage"] !== void 0) {
29657
29735
  updateParams.SmsVerificationMessage = properties["SmsVerificationMessage"];
29658
29736
  }
29659
29737
  await this.getClient().send(new UpdateUserPoolCommand(updateParams));
@@ -31016,6 +31094,24 @@ var ServiceDiscoveryProvider = class {
31016
31094
  return void 0;
31017
31095
  }
31018
31096
  }
31097
+ /**
31098
+ * Declare drift-unreadable property paths.
31099
+ *
31100
+ * - `AWS::ServiceDiscovery::PrivateDnsNamespace.Vpc`: Cloud Map's
31101
+ * `GetNamespace` does NOT return the VPC ID — it is only consumed at
31102
+ * create time and surfaced in opaque form via
31103
+ * `Properties.DnsProperties.HostedZoneId`. Without this declaration
31104
+ * the comparator would walk into `Vpc` (state has it because cdkd
31105
+ * stored the user-supplied template value) and report a guaranteed
31106
+ * false-positive on every clean drift run, since `readCurrentState`
31107
+ * deliberately omits the key.
31108
+ */
31109
+ getDriftUnknownPaths(resourceType) {
31110
+ if (resourceType === "AWS::ServiceDiscovery::PrivateDnsNamespace") {
31111
+ return ["Vpc"];
31112
+ }
31113
+ return [];
31114
+ }
31019
31115
  async readNamespace(physicalId) {
31020
31116
  let ns;
31021
31117
  try {
@@ -33255,6 +33351,11 @@ import {
33255
33351
  ListTagsForStreamCommand,
33256
33352
  ResourceNotFoundException as ResourceNotFoundException13
33257
33353
  } from "@aws-sdk/client-kinesis";
33354
+ function isKmsEncryption(value) {
33355
+ if (!value)
33356
+ return false;
33357
+ return value["EncryptionType"] === "KMS";
33358
+ }
33258
33359
  var KinesisStreamProvider = class {
33259
33360
  client;
33260
33361
  providerRegion = process.env["AWS_REGION"];
@@ -33337,14 +33438,13 @@ var KinesisStreamProvider = class {
33337
33438
  await this.waitForStreamActive(streamName);
33338
33439
  }
33339
33440
  const streamEncryption = properties["StreamEncryption"];
33340
- if (streamEncryption) {
33341
- const encryptionType = streamEncryption["EncryptionType"] ?? "KMS";
33441
+ if (isKmsEncryption(streamEncryption)) {
33342
33442
  const keyId = streamEncryption["KeyId"];
33343
33443
  this.logger.debug(`Enabling stream encryption for ${streamName}`);
33344
33444
  await this.getClient().send(
33345
33445
  new StartStreamEncryptionCommand({
33346
33446
  StreamName: streamName,
33347
- EncryptionType: encryptionType,
33447
+ EncryptionType: "KMS",
33348
33448
  KeyId: keyId
33349
33449
  })
33350
33450
  );
@@ -33431,23 +33531,27 @@ var KinesisStreamProvider = class {
33431
33531
  );
33432
33532
  const newEncryption = properties["StreamEncryption"];
33433
33533
  const oldEncryption = previousProperties["StreamEncryption"];
33434
- if (JSON.stringify(newEncryption) !== JSON.stringify(oldEncryption)) {
33435
- if (oldEncryption) {
33534
+ const oldIsKms = isKmsEncryption(oldEncryption);
33535
+ const newIsKms = isKmsEncryption(newEncryption);
33536
+ const oldKeyId = oldIsKms ? oldEncryption["KeyId"] : void 0;
33537
+ const newKeyId = newIsKms ? newEncryption["KeyId"] : void 0;
33538
+ if (oldIsKms !== newIsKms || oldIsKms && newIsKms && oldKeyId !== newKeyId) {
33539
+ if (oldIsKms) {
33436
33540
  await this.getClient().send(
33437
33541
  new StopStreamEncryptionCommand({
33438
33542
  StreamName: physicalId,
33439
- EncryptionType: oldEncryption["EncryptionType"] ?? "KMS",
33440
- KeyId: oldEncryption["KeyId"]
33543
+ EncryptionType: "KMS",
33544
+ KeyId: oldKeyId
33441
33545
  })
33442
33546
  );
33443
33547
  await this.waitForStreamActive(physicalId);
33444
33548
  }
33445
- if (newEncryption) {
33549
+ if (newIsKms) {
33446
33550
  await this.getClient().send(
33447
33551
  new StartStreamEncryptionCommand({
33448
33552
  StreamName: physicalId,
33449
- EncryptionType: newEncryption["EncryptionType"] ?? "KMS",
33450
- KeyId: newEncryption["KeyId"]
33553
+ EncryptionType: "KMS",
33554
+ KeyId: newKeyId
33451
33555
  })
33452
33556
  );
33453
33557
  await this.waitForStreamActive(physicalId);
@@ -33603,10 +33707,11 @@ var KinesisStreamProvider = class {
33603
33707
  const result = {};
33604
33708
  if (stream.StreamName !== void 0)
33605
33709
  result["Name"] = stream.StreamName;
33606
- if (stream.StreamModeDetails?.StreamMode !== void 0) {
33607
- result["StreamModeDetails"] = { StreamMode: stream.StreamModeDetails.StreamMode };
33710
+ const streamMode = stream.StreamModeDetails?.StreamMode;
33711
+ if (streamMode !== void 0) {
33712
+ result["StreamModeDetails"] = { StreamMode: streamMode };
33608
33713
  }
33609
- if (stream.Shards && stream.Shards.length > 0) {
33714
+ if (streamMode === "PROVISIONED" && stream.Shards && stream.Shards.length > 0) {
33610
33715
  result["ShardCount"] = stream.Shards.length;
33611
33716
  }
33612
33717
  if (stream.RetentionPeriodHours !== void 0) {
@@ -34821,14 +34926,14 @@ var FirehoseProvider = class {
34821
34926
  const tagsResp = await this.getClient().send(
34822
34927
  new ListTagsForDeliveryStreamCommand({ DeliveryStreamName: physicalId })
34823
34928
  );
34824
- const tags = normalizeAwsTagsToCfn(tagsResp.Tags);
34825
- result["Tags"] = tags;
34929
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
34826
34930
  } catch (err) {
34827
34931
  if (err instanceof ResourceNotFoundException14)
34828
34932
  return void 0;
34829
34933
  this.logger.debug(
34830
34934
  `Firehose ListTagsForDeliveryStream(${physicalId}) failed: ${err instanceof Error ? err.message : String(err)}`
34831
34935
  );
34936
+ result["Tags"] = [];
34832
34937
  }
34833
34938
  return result;
34834
34939
  }
@@ -35033,16 +35138,21 @@ var CloudTrailProvider = class {
35033
35138
  }
35034
35139
  async update(logicalId, physicalId, resourceType, properties, previousProperties) {
35035
35140
  this.logger.debug(`Updating CloudTrail Trail ${logicalId}: ${physicalId}`);
35141
+ const sanitizeArn = (v) => {
35142
+ if (v === void 0 || v === null || v === "")
35143
+ return void 0;
35144
+ return v;
35145
+ };
35036
35146
  const s3BucketName = properties["S3BucketName"];
35037
35147
  const s3KeyPrefix = properties["S3KeyPrefix"];
35038
35148
  const isMultiRegionTrail = properties["IsMultiRegionTrail"];
35039
35149
  const includeGlobalServiceEvents = properties["IncludeGlobalServiceEvents"];
35040
35150
  const enableLogFileValidation = properties["EnableLogFileValidation"];
35041
35151
  const isLogging = properties["IsLogging"];
35042
- const cloudWatchLogsLogGroupArn = properties["CloudWatchLogsLogGroupArn"];
35043
- const cloudWatchLogsRoleArn = properties["CloudWatchLogsRoleArn"];
35044
- const kmsKeyId = properties["KMSKeyId"];
35045
- const snsTopicName = properties["SnsTopicName"];
35152
+ const cloudWatchLogsLogGroupArn = sanitizeArn(properties["CloudWatchLogsLogGroupArn"]);
35153
+ const cloudWatchLogsRoleArn = sanitizeArn(properties["CloudWatchLogsRoleArn"]);
35154
+ const kmsKeyId = sanitizeArn(properties["KMSKeyId"]);
35155
+ const snsTopicName = sanitizeArn(properties["SnsTopicName"]);
35046
35156
  const isOrganizationTrail = properties["IsOrganizationTrail"];
35047
35157
  try {
35048
35158
  await this.getClient().send(
@@ -35239,58 +35349,48 @@ var CloudTrailProvider = class {
35239
35349
  result["TrailName"] = trail.Name;
35240
35350
  if (trail.S3BucketName !== void 0)
35241
35351
  result["S3BucketName"] = trail.S3BucketName;
35242
- if (trail.S3KeyPrefix !== void 0)
35243
- result["S3KeyPrefix"] = trail.S3KeyPrefix;
35244
- if (trail.IsMultiRegionTrail !== void 0) {
35245
- result["IsMultiRegionTrail"] = trail.IsMultiRegionTrail;
35246
- }
35247
- if (trail.IncludeGlobalServiceEvents !== void 0) {
35248
- result["IncludeGlobalServiceEvents"] = trail.IncludeGlobalServiceEvents;
35249
- }
35250
- if (trail.LogFileValidationEnabled !== void 0) {
35251
- result["EnableLogFileValidation"] = trail.LogFileValidationEnabled;
35252
- }
35253
- if (trail.CloudWatchLogsLogGroupArn !== void 0) {
35352
+ result["S3KeyPrefix"] = trail.S3KeyPrefix ?? "";
35353
+ result["IsMultiRegionTrail"] = trail.IsMultiRegionTrail ?? false;
35354
+ result["IncludeGlobalServiceEvents"] = trail.IncludeGlobalServiceEvents ?? true;
35355
+ result["EnableLogFileValidation"] = trail.LogFileValidationEnabled ?? false;
35356
+ if (trail.CloudWatchLogsLogGroupArn && trail.CloudWatchLogsRoleArn) {
35254
35357
  result["CloudWatchLogsLogGroupArn"] = trail.CloudWatchLogsLogGroupArn;
35255
- }
35256
- if (trail.CloudWatchLogsRoleArn !== void 0) {
35257
35358
  result["CloudWatchLogsRoleArn"] = trail.CloudWatchLogsRoleArn;
35258
35359
  }
35259
- if (trail.KmsKeyId !== void 0)
35260
- result["KMSKeyId"] = trail.KmsKeyId;
35261
- if (trail.SnsTopicName !== void 0)
35262
- result["SnsTopicName"] = trail.SnsTopicName;
35263
- if (trail.IsOrganizationTrail !== void 0) {
35264
- result["IsOrganizationTrail"] = trail.IsOrganizationTrail;
35265
- }
35360
+ result["KMSKeyId"] = trail.KmsKeyId ?? "";
35361
+ result["SnsTopicName"] = trail.SnsTopicName ?? "";
35362
+ result["IsOrganizationTrail"] = trail.IsOrganizationTrail ?? false;
35266
35363
  try {
35267
35364
  const status = await this.getClient().send(new GetTrailStatusCommand({ Name: physicalId }));
35268
- if (status.IsLogging !== void 0)
35269
- result["IsLogging"] = status.IsLogging;
35365
+ result["IsLogging"] = status.IsLogging ?? false;
35270
35366
  } catch {
35271
35367
  }
35272
35368
  try {
35273
35369
  const sel = await this.getClient().send(
35274
35370
  new GetEventSelectorsCommand({ TrailName: physicalId })
35275
35371
  );
35276
- result["EventSelectors"] = (sel.EventSelectors ?? []).map(
35277
- (es) => es
35278
- );
35372
+ const hasAdvanced = Array.isArray(sel.AdvancedEventSelectors) && sel.AdvancedEventSelectors.length > 0;
35373
+ if (!hasAdvanced) {
35374
+ result["EventSelectors"] = (sel.EventSelectors ?? []).map(
35375
+ (es) => es
35376
+ );
35377
+ }
35279
35378
  } catch {
35280
35379
  }
35380
+ let tags = [];
35281
35381
  if (trail.TrailARN) {
35282
35382
  try {
35283
35383
  const tagsResp = await this.getClient().send(
35284
35384
  new ListTagsCommand3({ ResourceIdList: [trail.TrailARN] })
35285
35385
  );
35286
- const tags = normalizeAwsTagsToCfn(tagsResp.ResourceTagList?.[0]?.TagsList);
35287
- result["Tags"] = tags;
35386
+ tags = normalizeAwsTagsToCfn(tagsResp.ResourceTagList?.[0]?.TagsList);
35288
35387
  } catch (err) {
35289
35388
  this.logger.debug(
35290
35389
  `CloudTrail ListTags(${trail.TrailARN}) failed: ${err instanceof Error ? err.message : String(err)}`
35291
35390
  );
35292
35391
  }
35293
35392
  }
35393
+ result["Tags"] = tags;
35294
35394
  return result;
35295
35395
  }
35296
35396
  async import(input) {
@@ -35421,7 +35521,12 @@ var CodeBuildProvider = class {
35421
35521
  const name = properties["Name"] ?? logicalId;
35422
35522
  const source = properties["Source"];
35423
35523
  const environment = properties["Environment"];
35424
- const serviceRole = properties["ServiceRole"];
35524
+ const sanitizeOptionalString = (value) => {
35525
+ if (typeof value !== "string")
35526
+ return value;
35527
+ return value === "" ? void 0 : value;
35528
+ };
35529
+ const serviceRole = sanitizeOptionalString(properties["ServiceRole"]);
35425
35530
  const artifacts = properties["Artifacts"];
35426
35531
  const tags = properties["Tags"];
35427
35532
  const envVars = environment?.["EnvironmentVariables"];
@@ -35512,7 +35617,7 @@ var CodeBuildProvider = class {
35512
35617
  description: properties["Description"],
35513
35618
  timeoutInMinutes: properties["TimeoutInMinutes"],
35514
35619
  queuedTimeoutInMinutes: properties["QueuedTimeoutInMinutes"],
35515
- encryptionKey: properties["EncryptionKey"],
35620
+ encryptionKey: sanitizeOptionalString(properties["EncryptionKey"]),
35516
35621
  cache: cache2,
35517
35622
  vpcConfig,
35518
35623
  logsConfig,
@@ -35523,7 +35628,7 @@ var CodeBuildProvider = class {
35523
35628
  fileSystemLocations,
35524
35629
  buildBatchConfig,
35525
35630
  badgeEnabled: properties["BadgeEnabled"],
35526
- sourceVersion: properties["SourceVersion"]
35631
+ sourceVersion: sanitizeOptionalString(properties["SourceVersion"])
35527
35632
  };
35528
35633
  }
35529
35634
  async create(logicalId, resourceType, properties) {
@@ -35977,10 +36082,11 @@ var S3VectorsProvider = class {
35977
36082
  }
35978
36083
  if (bucket?.encryptionConfiguration) {
35979
36084
  const enc = {};
35980
- if (bucket.encryptionConfiguration.sseType !== void 0) {
35981
- enc["SSEType"] = bucket.encryptionConfiguration.sseType;
36085
+ const sseType = bucket.encryptionConfiguration.sseType;
36086
+ if (sseType !== void 0) {
36087
+ enc["SSEType"] = sseType;
35982
36088
  }
35983
- if (bucket.encryptionConfiguration.kmsKeyArn !== void 0) {
36089
+ if (sseType === "aws:kms" && bucket.encryptionConfiguration.kmsKeyArn !== void 0) {
35984
36090
  enc["KMSKeyArn"] = bucket.encryptionConfiguration.kmsKeyArn;
35985
36091
  }
35986
36092
  if (Object.keys(enc).length > 0)
@@ -43784,7 +43890,7 @@ function reorderArgs(argv) {
43784
43890
  }
43785
43891
  async function main() {
43786
43892
  const program = new Command14();
43787
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.50.11");
43893
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.50.13");
43788
43894
  program.addCommand(createBootstrapCommand());
43789
43895
  program.addCommand(createSynthCommand());
43790
43896
  program.addCommand(createListCommand());