@aws/nx-plugin 1.0.0-rc.33 → 1.0.0-rc.35
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/LICENSE-THIRD-PARTY +28 -41
- package/generators.json +27 -0
- package/package.json +6 -6
- package/src/connection/generator.js +12 -1
- package/src/connection/generator.js.map +1 -1
- package/src/connection/supported-connections.d.ts +10 -1
- package/src/connection/supported-connections.js +13 -0
- package/src/connection/supported-connections.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +6 -6
- package/src/open-api/ts-client/__snapshots__/generator.complex-types.spec.ts.snap +12 -12
- package/src/open-api/ts-client/__snapshots__/generator.composite-types.spec.ts.snap +74 -10
- package/src/open-api/ts-client/__snapshots__/generator.content-type.spec.ts.snap +22 -4
- package/src/open-api/ts-client/__snapshots__/generator.duplicate-types.spec.ts.snap +53 -8
- package/src/open-api/ts-client/__snapshots__/generator.edge-cases.spec.ts.snap +32 -4
- package/src/open-api/ts-client/__snapshots__/generator.fast-api-gaps.spec.ts.snap +736 -0
- package/src/open-api/ts-client/__snapshots__/generator.fast-api.spec.ts.snap +86 -11
- package/src/open-api/ts-client/__snapshots__/generator.multipart.spec.ts.snap +21 -3
- package/src/open-api/ts-client/__snapshots__/generator.primitive-types.spec.ts.snap +2 -2
- package/src/open-api/ts-client/__snapshots__/generator.request.spec.ts.snap +6 -6
- package/src/open-api/ts-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +2 -2
- package/src/open-api/ts-client/__snapshots__/generator.spec-compliance.spec.ts.snap +1883 -0
- package/src/open-api/ts-client/__snapshots__/generator.tags.spec.ts.snap +4 -4
- package/src/open-api/ts-client/files/client.gen.ts.template +195 -12
- package/src/open-api/ts-client/files/types.gen.ts.template +2 -0
- package/src/open-api/ts-client/generator.js +22 -1
- package/src/open-api/ts-client/generator.js.map +1 -1
- package/src/open-api/utils/codegen-data/languages.js +6 -0
- package/src/open-api/utils/codegen-data/languages.js.map +1 -1
- package/src/open-api/utils/codegen-data/types.d.ts +16 -1
- package/src/open-api/utils/codegen-data/types.js.map +1 -1
- package/src/open-api/utils/codegen-data.js +71 -0
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.js +53 -8
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/open-api/utils/parser.js +48 -15
- package/src/open-api/utils/parser.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +4 -2
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +1 -1
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +186 -18
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2038 -0
- package/src/py/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +104 -0
- package/src/py/rdb/agent-connection/generator.d.ts +10 -0
- package/src/py/rdb/agent-connection/generator.js +46 -0
- package/src/py/rdb/agent-connection/generator.js.map +1 -0
- package/src/py/rdb/agent-connection/schema.d.js +8 -0
- package/src/py/rdb/agent-connection/schema.d.js.map +1 -0
- package/src/py/rdb/agent-connection/schema.d.ts +15 -0
- package/src/py/rdb/agent-connection/schema.json +27 -0
- package/src/py/rdb/fast-api-connection/__snapshots__/generator.spec.ts.snap +44 -0
- package/src/py/rdb/fast-api-connection/files/__apiModuleName__/dependencies/__rdbNameSnake__.py.template +14 -0
- package/src/py/rdb/fast-api-connection/generator.d.ts +10 -0
- package/src/py/rdb/fast-api-connection/generator.js +54 -0
- package/src/py/rdb/fast-api-connection/generator.js.map +1 -0
- package/src/py/rdb/fast-api-connection/schema.d.js +8 -0
- package/src/py/rdb/fast-api-connection/schema.d.js.map +1 -0
- package/src/py/rdb/fast-api-connection/schema.d.ts +13 -0
- package/src/py/rdb/fast-api-connection/schema.json +23 -0
- package/src/py/rdb/files/Dockerfile.create-db-user.template +10 -0
- package/src/py/rdb/files/Dockerfile.migration.template +10 -0
- package/src/py/rdb/files/__name__/__init__.py.template +3 -0
- package/src/py/rdb/files/__name__/connection.py.template +55 -0
- package/src/py/rdb/files/__name__/create_db_user_handler.py.template +97 -0
- package/src/py/rdb/files/__name__/migration_handler.py.template +36 -0
- package/src/py/rdb/files/__name__/models/__init__.py.template +3 -0
- package/src/py/rdb/files/__name__/models/example.py.template +8 -0
- package/src/py/rdb/files/__name__/utils.py.template +104 -0
- package/src/py/rdb/files/alembic.ini.template +38 -0
- package/src/py/rdb/files/config.json.template +14 -0
- package/src/py/rdb/files/migrations/env.py.template +80 -0
- package/src/py/rdb/files/migrations/script.py.mako.template +28 -0
- package/src/py/rdb/generator.d.ts +6 -0
- package/src/py/rdb/generator.js +263 -0
- package/src/py/rdb/generator.js.map +1 -0
- package/src/py/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +101 -0
- package/src/py/rdb/mcp-server-connection/generator.d.ts +10 -0
- package/src/py/rdb/mcp-server-connection/generator.js +46 -0
- package/src/py/rdb/mcp-server-connection/generator.js.map +1 -0
- package/src/py/rdb/mcp-server-connection/schema.d.js +8 -0
- package/src/py/rdb/mcp-server-connection/schema.d.js.map +1 -0
- package/src/py/rdb/mcp-server-connection/schema.d.ts +15 -0
- package/src/py/rdb/mcp-server-connection/schema.json +27 -0
- package/src/py/rdb/schema.d.js +6 -0
- package/src/py/rdb/schema.d.js.map +1 -0
- package/src/py/rdb/schema.d.ts +16 -0
- package/src/py/rdb/schema.json +77 -0
- package/src/py/rdb/utils.d.ts +6 -0
- package/src/py/rdb/utils.js +16 -0
- package/src/py/rdb/utils.js.map +1 -0
- package/src/sdk/py.d.ts +2 -0
- package/src/sdk/py.js +1 -0
- package/src/sdk/py.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +124 -12
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +186 -18
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +145 -173
- package/src/ts/rdb/generator.js +4 -3
- package/src/ts/rdb/generator.js.map +1 -1
- package/src/ts/rdb/schema.json +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +16 -16
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +31 -3
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +31 -3
- package/src/utils/rdb-constructs/files/cdk/app/dbs/__nameKebabCase__.ts.template +58 -14
- package/src/utils/rdb-constructs/files/cdk/core/rdb/aurora.ts.template +68 -78
- package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +88 -8
- package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +5 -32
- package/src/utils/rdb-constructs/rdb-constructs.d.ts +11 -1
- package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
- package/src/utils/shared-constructs.js +9 -21
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/shared-rdb-scripts.js +5 -1
- package/src/utils/shared-rdb-scripts.js.map +1 -1
- package/src/utils/versions.d.ts +34 -30
- package/src/utils/versions.js +34 -30
- package/src/utils/versions.js.map +1 -1
- package/src/utils/files/terraform/scripts/reset-runtime-config.ts.template +0 -25
|
@@ -290,6 +290,18 @@ variable "additional_iam_policy_statements" {
|
|
|
290
290
|
default = []
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
variable "appconfig_application_id" {
|
|
294
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
295
|
+
type = string
|
|
296
|
+
default = null
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
variable "appconfig_application_arn" {
|
|
300
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
301
|
+
type = string
|
|
302
|
+
default = null
|
|
303
|
+
}
|
|
304
|
+
|
|
293
305
|
variable "asset_bucket_name" {
|
|
294
306
|
description = "Name of the shared asset S3 bucket used to stage the Lambda deployment zip. Instantiate the \`core/asset-bucket\` module once per deployment and pass its \`bucket_name\` output here."
|
|
295
307
|
type = string
|
|
@@ -472,7 +484,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
472
484
|
PORT = "8000"
|
|
473
485
|
AWS_LWA_INVOKE_MODE = "buffered"
|
|
474
486
|
AWS_LAMBDA_EXEC_WRAPPER = "/opt/bootstrap"
|
|
475
|
-
}, var.
|
|
487
|
+
}, var.appconfig_application_id != null ? {
|
|
488
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
489
|
+
} : {}, var.env)
|
|
476
490
|
}
|
|
477
491
|
|
|
478
492
|
tags = var.tags
|
|
@@ -521,16 +535,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
521
535
|
|
|
522
536
|
# Additional IAM policies for Lambda (if provided)
|
|
523
537
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
524
|
-
count = length(
|
|
538
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
525
539
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
526
540
|
role = aws_iam_role.lambda_execution_role.id
|
|
527
541
|
|
|
528
542
|
policy = jsonencode({
|
|
529
543
|
Version = "2012-10-17"
|
|
530
|
-
Statement =
|
|
544
|
+
Statement = local.lambda_policy_statements
|
|
531
545
|
})
|
|
532
546
|
}
|
|
533
547
|
|
|
548
|
+
locals {
|
|
549
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
550
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
551
|
+
{
|
|
552
|
+
Effect = "Allow"
|
|
553
|
+
Action = [
|
|
554
|
+
"appconfig:StartConfigurationSession",
|
|
555
|
+
"appconfig:GetLatestConfiguration"
|
|
556
|
+
]
|
|
557
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
558
|
+
}
|
|
559
|
+
] : [], var.additional_iam_policy_statements)
|
|
560
|
+
}
|
|
561
|
+
|
|
534
562
|
# CloudWatch Log Group for Lambda
|
|
535
563
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
536
564
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -1012,6 +1040,18 @@ variable "additional_iam_policy_statements" {
|
|
|
1012
1040
|
default = []
|
|
1013
1041
|
}
|
|
1014
1042
|
|
|
1043
|
+
variable "appconfig_application_id" {
|
|
1044
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
1045
|
+
type = string
|
|
1046
|
+
default = null
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
variable "appconfig_application_arn" {
|
|
1050
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
1051
|
+
type = string
|
|
1052
|
+
default = null
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1015
1055
|
variable "asset_bucket_name" {
|
|
1016
1056
|
description = "Name of the shared asset S3 bucket used to stage the Lambda deployment zip. Instantiate the \`core/asset-bucket\` module once per deployment and pass its \`bucket_name\` output here."
|
|
1017
1057
|
type = string
|
|
@@ -1194,7 +1234,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
1194
1234
|
PORT = "8000"
|
|
1195
1235
|
AWS_LWA_INVOKE_MODE = "buffered"
|
|
1196
1236
|
AWS_LAMBDA_EXEC_WRAPPER = "/opt/bootstrap"
|
|
1197
|
-
}, var.
|
|
1237
|
+
}, var.appconfig_application_id != null ? {
|
|
1238
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
1239
|
+
} : {}, var.env)
|
|
1198
1240
|
}
|
|
1199
1241
|
|
|
1200
1242
|
tags = var.tags
|
|
@@ -1243,16 +1285,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
1243
1285
|
|
|
1244
1286
|
# Additional IAM policies for Lambda (if provided)
|
|
1245
1287
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
1246
|
-
count = length(
|
|
1288
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
1247
1289
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
1248
1290
|
role = aws_iam_role.lambda_execution_role.id
|
|
1249
1291
|
|
|
1250
1292
|
policy = jsonencode({
|
|
1251
1293
|
Version = "2012-10-17"
|
|
1252
|
-
Statement =
|
|
1294
|
+
Statement = local.lambda_policy_statements
|
|
1253
1295
|
})
|
|
1254
1296
|
}
|
|
1255
1297
|
|
|
1298
|
+
locals {
|
|
1299
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
1300
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
1301
|
+
{
|
|
1302
|
+
Effect = "Allow"
|
|
1303
|
+
Action = [
|
|
1304
|
+
"appconfig:StartConfigurationSession",
|
|
1305
|
+
"appconfig:GetLatestConfiguration"
|
|
1306
|
+
]
|
|
1307
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
1308
|
+
}
|
|
1309
|
+
] : [], var.additional_iam_policy_statements)
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1256
1312
|
# CloudWatch Log Group for Lambda
|
|
1257
1313
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
1258
1314
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -1816,6 +1872,18 @@ variable "additional_iam_policy_statements" {
|
|
|
1816
1872
|
default = []
|
|
1817
1873
|
}
|
|
1818
1874
|
|
|
1875
|
+
variable "appconfig_application_id" {
|
|
1876
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
1877
|
+
type = string
|
|
1878
|
+
default = null
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
variable "appconfig_application_arn" {
|
|
1882
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
1883
|
+
type = string
|
|
1884
|
+
default = null
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1819
1887
|
variable "asset_bucket_name" {
|
|
1820
1888
|
description = "Name of the shared asset S3 bucket used to stage the Lambda deployment zip. Instantiate the \`core/asset-bucket\` module once per deployment and pass its \`bucket_name\` output here."
|
|
1821
1889
|
type = string
|
|
@@ -1998,7 +2066,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
1998
2066
|
PORT = "8000"
|
|
1999
2067
|
AWS_LWA_INVOKE_MODE = "buffered"
|
|
2000
2068
|
AWS_LAMBDA_EXEC_WRAPPER = "/opt/bootstrap"
|
|
2001
|
-
}, var.
|
|
2069
|
+
}, var.appconfig_application_id != null ? {
|
|
2070
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
2071
|
+
} : {}, var.env)
|
|
2002
2072
|
}
|
|
2003
2073
|
|
|
2004
2074
|
tags = var.tags
|
|
@@ -2047,16 +2117,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
2047
2117
|
|
|
2048
2118
|
# Additional IAM policies for Lambda (if provided)
|
|
2049
2119
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
2050
|
-
count = length(
|
|
2120
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
2051
2121
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
2052
2122
|
role = aws_iam_role.lambda_execution_role.id
|
|
2053
2123
|
|
|
2054
2124
|
policy = jsonencode({
|
|
2055
2125
|
Version = "2012-10-17"
|
|
2056
|
-
Statement =
|
|
2126
|
+
Statement = local.lambda_policy_statements
|
|
2057
2127
|
})
|
|
2058
2128
|
}
|
|
2059
2129
|
|
|
2130
|
+
locals {
|
|
2131
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
2132
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
2133
|
+
{
|
|
2134
|
+
Effect = "Allow"
|
|
2135
|
+
Action = [
|
|
2136
|
+
"appconfig:StartConfigurationSession",
|
|
2137
|
+
"appconfig:GetLatestConfiguration"
|
|
2138
|
+
]
|
|
2139
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
2140
|
+
}
|
|
2141
|
+
] : [], var.additional_iam_policy_statements)
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2060
2144
|
# CloudWatch Log Group for Lambda
|
|
2061
2145
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
2062
2146
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -2544,6 +2628,18 @@ variable "additional_iam_policy_statements" {
|
|
|
2544
2628
|
default = []
|
|
2545
2629
|
}
|
|
2546
2630
|
|
|
2631
|
+
variable "appconfig_application_id" {
|
|
2632
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
2633
|
+
type = string
|
|
2634
|
+
default = null
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
variable "appconfig_application_arn" {
|
|
2638
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
2639
|
+
type = string
|
|
2640
|
+
default = null
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2547
2643
|
variable "asset_bucket_name" {
|
|
2548
2644
|
description = "Name of the shared asset S3 bucket used to stage the Lambda deployment zip. Instantiate the \`core/asset-bucket\` module once per deployment and pass its \`bucket_name\` output here."
|
|
2549
2645
|
type = string
|
|
@@ -2735,7 +2831,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
2735
2831
|
PORT = "8000"
|
|
2736
2832
|
AWS_LWA_INVOKE_MODE = "response_stream"
|
|
2737
2833
|
AWS_LAMBDA_EXEC_WRAPPER = "/opt/bootstrap"
|
|
2738
|
-
}, var.
|
|
2834
|
+
}, var.appconfig_application_id != null ? {
|
|
2835
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
2836
|
+
} : {}, var.env)
|
|
2739
2837
|
}
|
|
2740
2838
|
|
|
2741
2839
|
tags = var.tags
|
|
@@ -2784,16 +2882,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
2784
2882
|
|
|
2785
2883
|
# Additional IAM policies for Lambda (if provided)
|
|
2786
2884
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
2787
|
-
count = length(
|
|
2885
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
2788
2886
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
2789
2887
|
role = aws_iam_role.lambda_execution_role.id
|
|
2790
2888
|
|
|
2791
2889
|
policy = jsonencode({
|
|
2792
2890
|
Version = "2012-10-17"
|
|
2793
|
-
Statement =
|
|
2891
|
+
Statement = local.lambda_policy_statements
|
|
2794
2892
|
})
|
|
2795
2893
|
}
|
|
2796
2894
|
|
|
2895
|
+
locals {
|
|
2896
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
2897
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
2898
|
+
{
|
|
2899
|
+
Effect = "Allow"
|
|
2900
|
+
Action = [
|
|
2901
|
+
"appconfig:StartConfigurationSession",
|
|
2902
|
+
"appconfig:GetLatestConfiguration"
|
|
2903
|
+
]
|
|
2904
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
2905
|
+
}
|
|
2906
|
+
] : [], var.additional_iam_policy_statements)
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2797
2909
|
# CloudWatch Log Group for Lambda
|
|
2798
2910
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
2799
2911
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -3512,6 +3624,18 @@ variable "additional_iam_policy_statements" {
|
|
|
3512
3624
|
default = []
|
|
3513
3625
|
}
|
|
3514
3626
|
|
|
3627
|
+
variable "appconfig_application_id" {
|
|
3628
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
3629
|
+
type = string
|
|
3630
|
+
default = null
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3633
|
+
variable "appconfig_application_arn" {
|
|
3634
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
3635
|
+
type = string
|
|
3636
|
+
default = null
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3515
3639
|
variable "asset_bucket_name" {
|
|
3516
3640
|
description = "Name of the shared asset S3 bucket used to stage the Lambda deployment zip. Instantiate the \`core/asset-bucket\` module once per deployment and pass its \`bucket_name\` output here."
|
|
3517
3641
|
type = string
|
|
@@ -3703,7 +3827,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
3703
3827
|
PORT = "8000"
|
|
3704
3828
|
AWS_LWA_INVOKE_MODE = "response_stream"
|
|
3705
3829
|
AWS_LAMBDA_EXEC_WRAPPER = "/opt/bootstrap"
|
|
3706
|
-
}, var.
|
|
3830
|
+
}, var.appconfig_application_id != null ? {
|
|
3831
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
3832
|
+
} : {}, var.env)
|
|
3707
3833
|
}
|
|
3708
3834
|
|
|
3709
3835
|
tags = var.tags
|
|
@@ -3752,16 +3878,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
3752
3878
|
|
|
3753
3879
|
# Additional IAM policies for Lambda (if provided)
|
|
3754
3880
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
3755
|
-
count = length(
|
|
3881
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
3756
3882
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
3757
3883
|
role = aws_iam_role.lambda_execution_role.id
|
|
3758
3884
|
|
|
3759
3885
|
policy = jsonencode({
|
|
3760
3886
|
Version = "2012-10-17"
|
|
3761
|
-
Statement =
|
|
3887
|
+
Statement = local.lambda_policy_statements
|
|
3762
3888
|
})
|
|
3763
3889
|
}
|
|
3764
3890
|
|
|
3891
|
+
locals {
|
|
3892
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
3893
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
3894
|
+
{
|
|
3895
|
+
Effect = "Allow"
|
|
3896
|
+
Action = [
|
|
3897
|
+
"appconfig:StartConfigurationSession",
|
|
3898
|
+
"appconfig:GetLatestConfiguration"
|
|
3899
|
+
]
|
|
3900
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
3901
|
+
}
|
|
3902
|
+
] : [], var.additional_iam_policy_statements)
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3765
3905
|
# CloudWatch Log Group for Lambda
|
|
3766
3906
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
3767
3907
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -4479,6 +4619,18 @@ variable "additional_iam_policy_statements" {
|
|
|
4479
4619
|
default = []
|
|
4480
4620
|
}
|
|
4481
4621
|
|
|
4622
|
+
variable "appconfig_application_id" {
|
|
4623
|
+
description = "ID of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_id\`). When set, the Lambda functions receive \`RUNTIME_CONFIG_APP_ID\` and read access to the application."
|
|
4624
|
+
type = string
|
|
4625
|
+
default = null
|
|
4626
|
+
}
|
|
4627
|
+
|
|
4628
|
+
variable "appconfig_application_arn" {
|
|
4629
|
+
description = "ARN of the shared runtime-config AppConfig application (from \`core/runtime-config/appconfig.application_arn\`). Used to scope the IAM read permission granted to the Lambda functions."
|
|
4630
|
+
type = string
|
|
4631
|
+
default = null
|
|
4632
|
+
}
|
|
4633
|
+
|
|
4482
4634
|
variable "asset_bucket_name" {
|
|
4483
4635
|
description = "Name of the shared asset S3 bucket used to stage the Lambda deployment zip. Instantiate the \`core/asset-bucket\` module once per deployment and pass its \`bucket_name\` output here."
|
|
4484
4636
|
type = string
|
|
@@ -4670,7 +4822,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
4670
4822
|
PORT = "8000"
|
|
4671
4823
|
AWS_LWA_INVOKE_MODE = "response_stream"
|
|
4672
4824
|
AWS_LAMBDA_EXEC_WRAPPER = "/opt/bootstrap"
|
|
4673
|
-
}, var.
|
|
4825
|
+
}, var.appconfig_application_id != null ? {
|
|
4826
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
4827
|
+
} : {}, var.env)
|
|
4674
4828
|
}
|
|
4675
4829
|
|
|
4676
4830
|
tags = var.tags
|
|
@@ -4719,16 +4873,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
4719
4873
|
|
|
4720
4874
|
# Additional IAM policies for Lambda (if provided)
|
|
4721
4875
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
4722
|
-
count = length(
|
|
4876
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
4723
4877
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
4724
4878
|
role = aws_iam_role.lambda_execution_role.id
|
|
4725
4879
|
|
|
4726
4880
|
policy = jsonencode({
|
|
4727
4881
|
Version = "2012-10-17"
|
|
4728
|
-
Statement =
|
|
4882
|
+
Statement = local.lambda_policy_statements
|
|
4729
4883
|
})
|
|
4730
4884
|
}
|
|
4731
4885
|
|
|
4886
|
+
locals {
|
|
4887
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
4888
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
4889
|
+
{
|
|
4890
|
+
Effect = "Allow"
|
|
4891
|
+
Action = [
|
|
4892
|
+
"appconfig:StartConfigurationSession",
|
|
4893
|
+
"appconfig:GetLatestConfiguration"
|
|
4894
|
+
]
|
|
4895
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
4896
|
+
}
|
|
4897
|
+
] : [], var.additional_iam_policy_statements)
|
|
4898
|
+
}
|
|
4899
|
+
|
|
4732
4900
|
# CloudWatch Log Group for Lambda
|
|
4733
4901
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
4734
4902
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|