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

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "1.0.0-rc.42",
3
+ "version": "1.0.0-rc.43",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -1813,7 +1813,11 @@ export interface AuroraDatabaseProps extends _AuroraDatabaseProps {
1813
1813
  * Whether to export Aurora engine logs to CloudWatch Logs.
1814
1814
  * See https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html
1815
1815
  *
1816
- * @default false
1816
+ * PostgreSQL logs DDL statements only (log_statement=ddl); MySQL enables
1817
+ * Advanced Auditing scoped to connections and DDL (server_audit_events=CONNECT,QUERY_DDL).
1818
+ * Neither logs statement parameter values, to avoid leaking PII into log data.
1819
+ *
1820
+ * @default true
1817
1821
  */
1818
1822
  readonly enableCloudwatchLogs?: boolean;
1819
1823
 
@@ -1850,7 +1854,7 @@ export abstract class AuroraDatabase extends Construct {
1850
1854
  deletionProtection = true,
1851
1855
  removalPolicy = RemovalPolicy.RETAIN,
1852
1856
  enableKeyRotation = true,
1853
- enableCloudwatchLogs = false,
1857
+ enableCloudwatchLogs = true,
1854
1858
  enablePerformanceInsights = true,
1855
1859
  engine,
1856
1860
  engineVersion,
@@ -1882,9 +1886,20 @@ export abstract class AuroraDatabase extends Construct {
1882
1886
  monitoringInterval: Duration.seconds(5),
1883
1887
  cloudwatchLogsExports: enableCloudwatchLogs
1884
1888
  ? engine.type === 'mysql'
1885
- ? ['audit', 'error', 'general', 'slowquery']
1889
+ ? ['audit', 'error']
1886
1890
  : ['postgresql']
1887
1891
  : undefined,
1892
+ parameters: enableCloudwatchLogs
1893
+ ? engine.type === 'mysql'
1894
+ ? {
1895
+ server_audit_logging: '1',
1896
+ server_audit_events: 'CONNECT,QUERY_DDL',
1897
+ }
1898
+ : // Only safe statement-at-a-time; a multi-statement batch mixing
1899
+ // DDL with DML (e.g. one \`psql -c "a;b;c"\` call) logs the whole
1900
+ // raw text verbatim, including any literal DML values.
1901
+ { log_statement: 'ddl' }
1902
+ : undefined,
1888
1903
  defaultDatabaseName: databaseName,
1889
1904
  storageEncrypted: true,
1890
1905
  storageEncryptionKey: key,
@@ -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,
@@ -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
@@ -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
@@ -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,
@@ -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