@aws/nx-plugin 1.0.0-rc.42 → 1.0.0-rc.44

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.
Files changed (30) hide show
  1. package/LICENSE-THIRD-PARTY +121 -154
  2. package/package.json +4 -4
  3. package/src/connection/generator.js +1 -1
  4. package/src/connection/generator.js.map +1 -1
  5. package/src/infra/app/__snapshots__/generator.spec.ts.snap +8 -8
  6. package/src/preset/__snapshots__/generator.spec.ts.snap +1 -1
  7. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +7 -7
  8. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +6 -6
  9. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +2 -2
  10. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +4 -8
  11. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
  12. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  13. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
  14. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +23 -8
  15. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +7 -7
  16. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
  17. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +2 -2
  18. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +4 -8
  19. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  20. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
  21. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +88 -20
  22. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +24 -24
  23. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
  24. package/src/utils/files/common/scripts/src/dynamodb/start-container.ts.template +1 -3
  25. package/src/utils/files/common/scripts/src/rdb/shared/start-container.ts.template +1 -3
  26. package/src/utils/rdb-constructs/files/cdk/core/rdb/aurora.ts.template +18 -3
  27. package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +24 -5
  28. package/src/utils/versions.d.ts +51 -51
  29. package/src/utils/versions.js +49 -49
  30. package/src/utils/versions.js.map +1 -1
@@ -522,7 +522,11 @@ export interface AuroraDatabaseProps extends _AuroraDatabaseProps {
522
522
  * Whether to export Aurora engine logs to CloudWatch Logs.
523
523
  * See https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html
524
524
  *
525
- * @default false
525
+ * PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables
526
+ * Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL).
527
+ * Neither logs statement parameter values, to avoid leaking PII into log data.
528
+ *
529
+ * @default true
526
530
  */
527
531
  readonly enableCloudwatchLogs?: boolean;
528
532
 
@@ -559,7 +563,7 @@ export abstract class AuroraDatabase extends Construct {
559
563
  deletionProtection = true,
560
564
  removalPolicy = RemovalPolicy.RETAIN,
561
565
  enableKeyRotation = true,
562
- enableCloudwatchLogs = false,
566
+ enableCloudwatchLogs = true,
563
567
  enablePerformanceInsights = true,
564
568
  engine,
565
569
  engineVersion,
@@ -591,9 +595,20 @@ export abstract class AuroraDatabase extends Construct {
591
595
  monitoringInterval: Duration.seconds(5),
592
596
  cloudwatchLogsExports: enableCloudwatchLogs
593
597
  ? engine.type === 'mysql'
594
- ? ['audit', 'error', 'general', 'slowquery']
598
+ ? ['audit', 'error']
595
599
  : ['postgresql']
596
600
  : undefined,
601
+ parameters: enableCloudwatchLogs
602
+ ? engine.type === 'mysql'
603
+ ? {
604
+ server_audit_logging: '1',
605
+ server_audit_events: 'CONNECT,QUERY_DDL',
606
+ }
607
+ : // Only safe statement-at-a-time; a multi-statement batch mixing
608
+ // DDL with DML (e.g. one \`psql -c "a;b;c"\` call) logs the whole
609
+ // raw text verbatim, including any literal DML values.
610
+ { log_statement: 'ddl' }
611
+ : undefined,
597
612
  defaultDatabaseName: databaseName,
598
613
  storageEncrypted: true,
599
614
  storageEncryptionKey: key,
@@ -782,7 +797,7 @@ terraform {
782
797
  required_providers {
783
798
  aws = {
784
799
  source = "hashicorp/aws"
785
- version = "6.54.0"
800
+ version = "6.55.0"
786
801
  }
787
802
  null = {
788
803
  source = "hashicorp/null"
@@ -899,9 +914,9 @@ variable "enable_credential_rotation" {
899
914
  }
900
915
 
901
916
  variable "enable_cloudwatch_logs" {
902
- description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL also enables verbose statement logging."
917
+ description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL). Neither logs statement parameter values, to avoid leaking PII into log data."
903
918
  type = bool
904
- default = false
919
+ default = true
905
920
  }
906
921
 
907
922
  variable "enable_performance_insights" {
@@ -956,11 +971,30 @@ resource "aws_rds_cluster_parameter_group" "database" {
956
971
  family = local.parameter_group_family
957
972
  description = "Parameter group for \${var.name} Aurora cluster"
958
973
 
974
+ # Only safe statement-at-a-time; a multi-statement batch mixing DDL with
975
+ # DML (e.g. one \`psql -c "a;b;c"\` call) logs the whole raw text verbatim,
976
+ # including any literal DML values.
959
977
  dynamic "parameter" {
960
978
  for_each = var.engine == "aurora-postgresql" ? [1] : []
961
979
  content {
962
980
  name = "log_statement"
963
- value = "all"
981
+ value = "ddl"
982
+ }
983
+ }
984
+
985
+ dynamic "parameter" {
986
+ for_each = var.engine == "aurora-mysql" ? [1] : []
987
+ content {
988
+ name = "server_audit_logging"
989
+ value = "1"
990
+ }
991
+ }
992
+
993
+ dynamic "parameter" {
994
+ for_each = var.engine == "aurora-mysql" ? [1] : []
995
+ content {
996
+ name = "server_audit_events"
997
+ value = "CONNECT,QUERY_DDL"
964
998
  }
965
999
  }
966
1000
 
@@ -1082,7 +1116,7 @@ resource "aws_secretsmanager_secret_version" "credentials" {
1082
1116
  }
1083
1117
 
1084
1118
  resource "aws_rds_cluster" "database" {
1085
- #checkov:skip=CKV2_AWS_27:Query logging can be enabled with enable_cloudwatch_logs; this module defaults to CDK-equivalent behavior unless logging is requested
1119
+ #checkov:skip=CKV2_AWS_27:Query logging is enabled by default via enable_cloudwatch_logs; checkov cannot resolve the conditional count expression on aws_rds_cluster_parameter_group.database
1086
1120
  #checkov:skip=CKV_AWS_139:Deletion protection is enabled but checkov is unable to detect it correctly
1087
1121
  cluster_identifier = local.cluster_name
1088
1122
  engine = var.engine
@@ -1103,7 +1137,7 @@ resource "aws_rds_cluster" "database" {
1103
1137
  monitoring_interval = 5
1104
1138
  monitoring_role_arn = aws_iam_role.enhanced_monitoring.arn
1105
1139
  copy_tags_to_snapshot = true
1106
- enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error", "general", "slowquery"] : ["postgresql"]) : null
1140
+ enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error"] : ["postgresql"]) : null
1107
1141
 
1108
1142
  serverlessv2_scaling_configuration {
1109
1143
  min_capacity = var.serverless_min_capacity
@@ -1517,7 +1551,7 @@ exports[`ts#rdb generator > should generate terraform modules when iac is Terraf
1517
1551
  }
1518
1552
  aws = {
1519
1553
  source = "hashicorp/aws"
1520
- version = "6.54.0"
1554
+ version = "6.55.0"
1521
1555
  }
1522
1556
  null = {
1523
1557
  source = "hashicorp/null"
@@ -2249,7 +2283,7 @@ terraform {
2249
2283
  required_providers {
2250
2284
  aws = {
2251
2285
  source = "hashicorp/aws"
2252
- version = "6.54.0"
2286
+ version = "6.55.0"
2253
2287
  }
2254
2288
  null = {
2255
2289
  source = "hashicorp/null"
@@ -2366,9 +2400,9 @@ variable "enable_credential_rotation" {
2366
2400
  }
2367
2401
 
2368
2402
  variable "enable_cloudwatch_logs" {
2369
- description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL also enables verbose statement logging."
2403
+ description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL). Neither logs statement parameter values, to avoid leaking PII into log data."
2370
2404
  type = bool
2371
- default = false
2405
+ default = true
2372
2406
  }
2373
2407
 
2374
2408
  variable "enable_performance_insights" {
@@ -2423,11 +2457,30 @@ resource "aws_rds_cluster_parameter_group" "database" {
2423
2457
  family = local.parameter_group_family
2424
2458
  description = "Parameter group for \${var.name} Aurora cluster"
2425
2459
 
2460
+ # Only safe statement-at-a-time; a multi-statement batch mixing DDL with
2461
+ # DML (e.g. one \`psql -c "a;b;c"\` call) logs the whole raw text verbatim,
2462
+ # including any literal DML values.
2426
2463
  dynamic "parameter" {
2427
2464
  for_each = var.engine == "aurora-postgresql" ? [1] : []
2428
2465
  content {
2429
2466
  name = "log_statement"
2430
- value = "all"
2467
+ value = "ddl"
2468
+ }
2469
+ }
2470
+
2471
+ dynamic "parameter" {
2472
+ for_each = var.engine == "aurora-mysql" ? [1] : []
2473
+ content {
2474
+ name = "server_audit_logging"
2475
+ value = "1"
2476
+ }
2477
+ }
2478
+
2479
+ dynamic "parameter" {
2480
+ for_each = var.engine == "aurora-mysql" ? [1] : []
2481
+ content {
2482
+ name = "server_audit_events"
2483
+ value = "CONNECT,QUERY_DDL"
2431
2484
  }
2432
2485
  }
2433
2486
 
@@ -2549,7 +2602,7 @@ resource "aws_secretsmanager_secret_version" "credentials" {
2549
2602
  }
2550
2603
 
2551
2604
  resource "aws_rds_cluster" "database" {
2552
- #checkov:skip=CKV2_AWS_27:Query logging can be enabled with enable_cloudwatch_logs; this module defaults to CDK-equivalent behavior unless logging is requested
2605
+ #checkov:skip=CKV2_AWS_27:Query logging is enabled by default via enable_cloudwatch_logs; checkov cannot resolve the conditional count expression on aws_rds_cluster_parameter_group.database
2553
2606
  #checkov:skip=CKV_AWS_139:Deletion protection is enabled but checkov is unable to detect it correctly
2554
2607
  cluster_identifier = local.cluster_name
2555
2608
  engine = var.engine
@@ -2570,7 +2623,7 @@ resource "aws_rds_cluster" "database" {
2570
2623
  monitoring_interval = 5
2571
2624
  monitoring_role_arn = aws_iam_role.enhanced_monitoring.arn
2572
2625
  copy_tags_to_snapshot = true
2573
- enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error", "general", "slowquery"] : ["postgresql"]) : null
2626
+ enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error"] : ["postgresql"]) : null
2574
2627
 
2575
2628
  serverlessv2_scaling_configuration {
2576
2629
  min_capacity = var.serverless_min_capacity
@@ -2984,7 +3037,7 @@ exports[`ts#rdb generator > should generate terraform modules with MySQL engine
2984
3037
  }
2985
3038
  aws = {
2986
3039
  source = "hashicorp/aws"
2987
- version = "6.54.0"
3040
+ version = "6.55.0"
2988
3041
  }
2989
3042
  null = {
2990
3043
  source = "hashicorp/null"
@@ -4259,7 +4312,11 @@ export interface AuroraDatabaseProps extends _AuroraDatabaseProps {
4259
4312
  * Whether to export Aurora engine logs to CloudWatch Logs.
4260
4313
  * See https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html
4261
4314
  *
4262
- * @default false
4315
+ * PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables
4316
+ * Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL).
4317
+ * Neither logs statement parameter values, to avoid leaking PII into log data.
4318
+ *
4319
+ * @default true
4263
4320
  */
4264
4321
  readonly enableCloudwatchLogs?: boolean;
4265
4322
 
@@ -4296,7 +4353,7 @@ export abstract class AuroraDatabase extends Construct {
4296
4353
  deletionProtection = true,
4297
4354
  removalPolicy = RemovalPolicy.RETAIN,
4298
4355
  enableKeyRotation = true,
4299
- enableCloudwatchLogs = false,
4356
+ enableCloudwatchLogs = true,
4300
4357
  enablePerformanceInsights = true,
4301
4358
  engine,
4302
4359
  engineVersion,
@@ -4328,9 +4385,20 @@ export abstract class AuroraDatabase extends Construct {
4328
4385
  monitoringInterval: Duration.seconds(5),
4329
4386
  cloudwatchLogsExports: enableCloudwatchLogs
4330
4387
  ? engine.type === 'mysql'
4331
- ? ['audit', 'error', 'general', 'slowquery']
4388
+ ? ['audit', 'error']
4332
4389
  : ['postgresql']
4333
4390
  : undefined,
4391
+ parameters: enableCloudwatchLogs
4392
+ ? engine.type === 'mysql'
4393
+ ? {
4394
+ server_audit_logging: '1',
4395
+ server_audit_events: 'CONNECT,QUERY_DDL',
4396
+ }
4397
+ : // Only safe statement-at-a-time; a multi-statement batch mixing
4398
+ // DDL with DML (e.g. one \`psql -c "a;b;c"\` call) logs the whole
4399
+ // raw text verbatim, including any literal DML values.
4400
+ { log_statement: 'ddl' }
4401
+ : undefined,
4334
4402
  defaultDatabaseName: databaseName,
4335
4403
  storageEncrypted: true,
4336
4404
  storageEncryptionKey: key,
@@ -131,7 +131,7 @@ exports[`react-website generator > TailwindCSS integration > terraform iac > sho
131
131
  required_providers {
132
132
  aws = {
133
133
  source = "hashicorp/aws"
134
- version = "6.54.0"
134
+ version = "6.55.0"
135
135
  configuration_aliases = [aws.us_east_1]
136
136
  }
137
137
  random = {
@@ -699,7 +699,7 @@ resource "null_resource" "upload_website_files" {
699
699
  provisioner "local-exec" {
700
700
  command = <<-EOT
701
701
  cd "$ROOT_PATH"
702
- uv run --with boto3==1.43.46 python3 -c "
702
+ uv run --with boto3==1.43.51 python3 -c "
703
703
  import os
704
704
  import sys
705
705
  import boto3
@@ -822,7 +822,7 @@ resource "null_resource" "cloudfront_invalidation" {
822
822
 
823
823
  provisioner "local-exec" {
824
824
  command = <<-EOT
825
- uv run --with boto3==1.43.46 python3 -c "
825
+ uv run --with boto3==1.43.51 python3 -c "
826
826
  import boto3
827
827
  import os
828
828
  import sys
@@ -908,7 +908,7 @@ output "waf_web_acl_arn" {
908
908
  required_providers {
909
909
  aws = {
910
910
  source = "hashicorp/aws"
911
- version = "6.54.0"
911
+ version = "6.55.0"
912
912
  configuration_aliases = [aws.us_east_1]
913
913
  }
914
914
  }
@@ -1119,14 +1119,14 @@ exports[`react-website generator > Tanstack router integration > should generate
1119
1119
  "{
1120
1120
  "name": "@proj/source",
1121
1121
  "dependencies": {
1122
- "@cloudscape-design/board-components": "3.0.201",
1123
- "@cloudscape-design/components": "3.0.1325",
1122
+ "@cloudscape-design/board-components": "3.0.205",
1123
+ "@cloudscape-design/components": "3.0.1330",
1124
1124
  "@cloudscape-design/global-styles": "1.0.62",
1125
1125
  "aws-cdk-lib": "2.261.0",
1126
- "constructs": "10.6.0",
1126
+ "constructs": "10.7.0",
1127
1127
  "react": "19.2.7",
1128
1128
  "react-dom": "19.2.7",
1129
- "tailwindcss": "4.3.2"
1129
+ "tailwindcss": "4.3.3"
1130
1130
  },
1131
1131
  "devDependencies": {
1132
1132
  "@nx/js": "23.1.0",
@@ -1135,7 +1135,7 @@ exports[`react-website generator > Tanstack router integration > should generate
1135
1135
  "@nx/vitest": "23.1.0",
1136
1136
  "@nx/web": "23.1.0",
1137
1137
  "@swc/helpers": "~0.5.18",
1138
- "@tailwindcss/vite": "4.3.2",
1138
+ "@tailwindcss/vite": "4.3.3",
1139
1139
  "@testing-library/dom": "10.4.0",
1140
1140
  "@testing-library/react": "16.3.0",
1141
1141
  "@types/node": "26.1.1",
@@ -1147,7 +1147,7 @@ exports[`react-website generator > Tanstack router integration > should generate
1147
1147
  "jiti": "2.4.2",
1148
1148
  "jsdom": "^27.1.0",
1149
1149
  "typescript": "~6.0.3",
1150
- "vite": "8.1.4",
1150
+ "vite": "8.1.5",
1151
1151
  "vitest": "4.1.10"
1152
1152
  },
1153
1153
  "type": "module"
@@ -2832,15 +2832,15 @@ exports[`react-website generator > Tanstack router integration > should generate
2832
2832
  "{
2833
2833
  "name": "@proj/source",
2834
2834
  "dependencies": {
2835
- "@cloudscape-design/board-components": "3.0.201",
2836
- "@cloudscape-design/components": "3.0.1325",
2835
+ "@cloudscape-design/board-components": "3.0.205",
2836
+ "@cloudscape-design/components": "3.0.1330",
2837
2837
  "@cloudscape-design/global-styles": "1.0.62",
2838
- "@tanstack/react-router": "1.170.17",
2838
+ "@tanstack/react-router": "1.170.18",
2839
2839
  "aws-cdk-lib": "2.261.0",
2840
- "constructs": "10.6.0",
2840
+ "constructs": "10.7.0",
2841
2841
  "react": "19.2.7",
2842
2842
  "react-dom": "19.2.7",
2843
- "tailwindcss": "4.3.2"
2843
+ "tailwindcss": "4.3.3"
2844
2844
  },
2845
2845
  "devDependencies": {
2846
2846
  "@nx/js": "23.1.0",
@@ -2849,9 +2849,9 @@ exports[`react-website generator > Tanstack router integration > should generate
2849
2849
  "@nx/vitest": "23.1.0",
2850
2850
  "@nx/web": "23.1.0",
2851
2851
  "@swc/helpers": "~0.5.18",
2852
- "@tailwindcss/vite": "4.3.2",
2853
- "@tanstack/router-generator": "1.167.18",
2854
- "@tanstack/router-plugin": "1.168.19",
2852
+ "@tailwindcss/vite": "4.3.3",
2853
+ "@tanstack/router-generator": "1.167.21",
2854
+ "@tanstack/router-plugin": "1.168.22",
2855
2855
  "@tanstack/router-utils": "1.162.2",
2856
2856
  "@tanstack/virtual-file-routes": "1.162.0",
2857
2857
  "@testing-library/dom": "10.4.0",
@@ -2865,7 +2865,7 @@ exports[`react-website generator > Tanstack router integration > should generate
2865
2865
  "jiti": "2.4.2",
2866
2866
  "jsdom": "^27.1.0",
2867
2867
  "typescript": "~6.0.3",
2868
- "vite": "8.1.4",
2868
+ "vite": "8.1.5",
2869
2869
  "vitest": "4.1.10"
2870
2870
  },
2871
2871
  "type": "module"
@@ -5367,15 +5367,15 @@ root &&
5367
5367
 
5368
5368
  exports[`react-website generator > should handle npm scope prefix correctly > scoped-dependencies 1`] = `
5369
5369
  {
5370
- "@cloudscape-design/board-components": "3.0.201",
5371
- "@cloudscape-design/components": "3.0.1325",
5370
+ "@cloudscape-design/board-components": "3.0.205",
5371
+ "@cloudscape-design/components": "3.0.1330",
5372
5372
  "@cloudscape-design/global-styles": "1.0.62",
5373
- "@tanstack/react-router": "1.170.17",
5373
+ "@tanstack/react-router": "1.170.18",
5374
5374
  "aws-cdk-lib": "2.261.0",
5375
- "constructs": "10.6.0",
5375
+ "constructs": "10.7.0",
5376
5376
  "react": "19.2.7",
5377
5377
  "react-dom": "19.2.7",
5378
- "tailwindcss": "4.3.2",
5378
+ "tailwindcss": "4.3.3",
5379
5379
  }
5380
5380
  `;
5381
5381
 
@@ -6,7 +6,7 @@ exports[`cognito-auth generator terraform iac > should generate terraform files
6
6
  required_providers {
7
7
  aws = {
8
8
  source = "hashicorp/aws"
9
- version = "6.54.0"
9
+ version = "6.55.0"
10
10
  }
11
11
  }
12
12
  }
@@ -63,7 +63,7 @@ resource "null_resource" "add_callback_url" {
63
63
 
64
64
  provisioner "local-exec" {
65
65
  command = <<-EOT
66
- uv run --with boto3==1.43.46 python -c "
66
+ uv run --with boto3==1.43.51 python -c "
67
67
  import boto3
68
68
  import os
69
69
  import sys
@@ -101,6 +101,4 @@ process.on('SIGTERM', cleanup);
101
101
  process.on('SIGINT', cleanup);
102
102
  process.on('SIGHUP', cleanup);
103
103
 
104
- logs.on('exit', (code) => {
105
- if (!exiting) process.exit(code ?? 0);
106
- });
104
+ logs.on('exit', cleanup);
@@ -112,6 +112,4 @@ process.on("SIGTERM", cleanup);
112
112
  process.on("SIGINT", cleanup);
113
113
  process.on("SIGHUP", cleanup);
114
114
 
115
- logs.on("exit", () => {
116
- if (!exiting) cleanup();
117
- });
115
+ logs.on("exit", cleanup);
@@ -166,7 +166,11 @@ export interface AuroraDatabaseProps extends _AuroraDatabaseProps {
166
166
  * Whether to export Aurora engine logs to CloudWatch Logs.
167
167
  * See https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html
168
168
  *
169
- * @default false
169
+ * PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables
170
+ * Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL).
171
+ * Neither logs statement parameter values, to avoid leaking PII into log data.
172
+ *
173
+ * @default true
170
174
  */
171
175
  readonly enableCloudwatchLogs?: boolean;
172
176
 
@@ -203,7 +207,7 @@ export abstract class AuroraDatabase extends Construct {
203
207
  deletionProtection = true,
204
208
  removalPolicy = RemovalPolicy.RETAIN,
205
209
  enableKeyRotation = true,
206
- enableCloudwatchLogs = false,
210
+ enableCloudwatchLogs = true,
207
211
  enablePerformanceInsights = true,
208
212
  engine,
209
213
  engineVersion,
@@ -235,9 +239,20 @@ export abstract class AuroraDatabase extends Construct {
235
239
  monitoringInterval: Duration.seconds(5),
236
240
  cloudwatchLogsExports: enableCloudwatchLogs
237
241
  ? engine.type === "mysql"
238
- ? ["audit", "error", "general", "slowquery"]
242
+ ? ["audit", "error"]
239
243
  : ["postgresql"]
240
244
  : undefined,
245
+ parameters: enableCloudwatchLogs
246
+ ? engine.type === "mysql"
247
+ ? {
248
+ server_audit_logging: "1",
249
+ server_audit_events: "CONNECT,QUERY_DDL",
250
+ }
251
+ : // Only safe statement-at-a-time; a multi-statement batch mixing
252
+ // DDL with DML (e.g. one `psql -c "a;b;c"` call) logs the whole
253
+ // raw text verbatim, including any literal DML values.
254
+ { log_statement: "ddl" }
255
+ : undefined,
241
256
  defaultDatabaseName: databaseName,
242
257
  storageEncrypted: true,
243
258
  storageEncryptionKey: key,
@@ -124,9 +124,9 @@ variable "enable_credential_rotation" {
124
124
  }
125
125
 
126
126
  variable "enable_cloudwatch_logs" {
127
- description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL also enables verbose statement logging."
127
+ description = "Whether to export Aurora engine logs to CloudWatch. PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL). Neither logs statement parameter values, to avoid leaking PII into log data."
128
128
  type = bool
129
- default = false
129
+ default = true
130
130
  }
131
131
 
132
132
  variable "enable_performance_insights" {
@@ -181,11 +181,30 @@ resource "aws_rds_cluster_parameter_group" "database" {
181
181
  family = local.parameter_group_family
182
182
  description = "Parameter group for ${var.name} Aurora cluster"
183
183
 
184
+ # Only safe statement-at-a-time; a multi-statement batch mixing DDL with
185
+ # DML (e.g. one `psql -c "a;b;c"` call) logs the whole raw text verbatim,
186
+ # including any literal DML values.
184
187
  dynamic "parameter" {
185
188
  for_each = var.engine == "aurora-postgresql" ? [1] : []
186
189
  content {
187
190
  name = "log_statement"
188
- value = "all"
191
+ value = "ddl"
192
+ }
193
+ }
194
+
195
+ dynamic "parameter" {
196
+ for_each = var.engine == "aurora-mysql" ? [1] : []
197
+ content {
198
+ name = "server_audit_logging"
199
+ value = "1"
200
+ }
201
+ }
202
+
203
+ dynamic "parameter" {
204
+ for_each = var.engine == "aurora-mysql" ? [1] : []
205
+ content {
206
+ name = "server_audit_events"
207
+ value = "CONNECT,QUERY_DDL"
189
208
  }
190
209
  }
191
210
 
@@ -307,7 +326,7 @@ resource "aws_secretsmanager_secret_version" "credentials" {
307
326
  }
308
327
 
309
328
  resource "aws_rds_cluster" "database" {
310
- #checkov:skip=CKV2_AWS_27:Query logging can be enabled with enable_cloudwatch_logs; this module defaults to CDK-equivalent behavior unless logging is requested
329
+ #checkov:skip=CKV2_AWS_27:Query logging is enabled by default via enable_cloudwatch_logs; checkov cannot resolve the conditional count expression on aws_rds_cluster_parameter_group.database
311
330
  #checkov:skip=CKV_AWS_139:Deletion protection is enabled but checkov is unable to detect it correctly
312
331
  cluster_identifier = local.cluster_name
313
332
  engine = var.engine
@@ -328,7 +347,7 @@ resource "aws_rds_cluster" "database" {
328
347
  monitoring_interval = 5
329
348
  monitoring_role_arn = aws_iam_role.enhanced_monitoring.arn
330
349
  copy_tags_to_snapshot = true
331
- enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error", "general", "slowquery"] : ["postgresql"]) : null
350
+ enabled_cloudwatch_logs_exports = var.enable_cloudwatch_logs ? (var.engine == "aurora-mysql" ? ["audit", "error"] : ["postgresql"]) : null
332
351
 
333
352
  serverlessv2_scaling_configuration {
334
353
  min_capacity = var.serverless_min_capacity