@aws/nx-plugin 1.0.0-rc.34 → 1.0.0-rc.36
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 +1 -1
- package/src/open-api/ts-client/files/client.gen.ts.template +8 -4
- package/src/open-api/utils/codegen-data.js +25 -0
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +186 -18
- 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/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
|
@@ -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
|
|
@@ -684,6 +684,18 @@ variable "additional_iam_policy_statements" {
|
|
|
684
684
|
default = []
|
|
685
685
|
}
|
|
686
686
|
|
|
687
|
+
variable "appconfig_application_id" {
|
|
688
|
+
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."
|
|
689
|
+
type = string
|
|
690
|
+
default = null
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
variable "appconfig_application_arn" {
|
|
694
|
+
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."
|
|
695
|
+
type = string
|
|
696
|
+
default = null
|
|
697
|
+
}
|
|
698
|
+
|
|
687
699
|
variable "asset_bucket_name" {
|
|
688
700
|
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."
|
|
689
701
|
type = string
|
|
@@ -866,7 +878,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
866
878
|
|
|
867
879
|
environment {
|
|
868
880
|
variables = merge({
|
|
869
|
-
}, var.
|
|
881
|
+
}, var.appconfig_application_id != null ? {
|
|
882
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
883
|
+
} : {}, var.env)
|
|
870
884
|
}
|
|
871
885
|
|
|
872
886
|
tags = var.tags
|
|
@@ -915,16 +929,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
915
929
|
|
|
916
930
|
# Additional IAM policies for Lambda (if provided)
|
|
917
931
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
918
|
-
count = length(
|
|
932
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
919
933
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
920
934
|
role = aws_iam_role.lambda_execution_role.id
|
|
921
935
|
|
|
922
936
|
policy = jsonencode({
|
|
923
937
|
Version = "2012-10-17"
|
|
924
|
-
Statement =
|
|
938
|
+
Statement = local.lambda_policy_statements
|
|
925
939
|
})
|
|
926
940
|
}
|
|
927
941
|
|
|
942
|
+
locals {
|
|
943
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
944
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
945
|
+
{
|
|
946
|
+
Effect = "Allow"
|
|
947
|
+
Action = [
|
|
948
|
+
"appconfig:StartConfigurationSession",
|
|
949
|
+
"appconfig:GetLatestConfiguration"
|
|
950
|
+
]
|
|
951
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
952
|
+
}
|
|
953
|
+
] : [], var.additional_iam_policy_statements)
|
|
954
|
+
}
|
|
955
|
+
|
|
928
956
|
# CloudWatch Log Group for Lambda
|
|
929
957
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
930
958
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -2115,6 +2143,18 @@ variable "additional_iam_policy_statements" {
|
|
|
2115
2143
|
default = []
|
|
2116
2144
|
}
|
|
2117
2145
|
|
|
2146
|
+
variable "appconfig_application_id" {
|
|
2147
|
+
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."
|
|
2148
|
+
type = string
|
|
2149
|
+
default = null
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
variable "appconfig_application_arn" {
|
|
2153
|
+
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."
|
|
2154
|
+
type = string
|
|
2155
|
+
default = null
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2118
2158
|
variable "asset_bucket_name" {
|
|
2119
2159
|
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."
|
|
2120
2160
|
type = string
|
|
@@ -2297,7 +2337,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
2297
2337
|
|
|
2298
2338
|
environment {
|
|
2299
2339
|
variables = merge({
|
|
2300
|
-
}, var.
|
|
2340
|
+
}, var.appconfig_application_id != null ? {
|
|
2341
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
2342
|
+
} : {}, var.env)
|
|
2301
2343
|
}
|
|
2302
2344
|
|
|
2303
2345
|
tags = var.tags
|
|
@@ -2346,16 +2388,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
2346
2388
|
|
|
2347
2389
|
# Additional IAM policies for Lambda (if provided)
|
|
2348
2390
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
2349
|
-
count = length(
|
|
2391
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
2350
2392
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
2351
2393
|
role = aws_iam_role.lambda_execution_role.id
|
|
2352
2394
|
|
|
2353
2395
|
policy = jsonencode({
|
|
2354
2396
|
Version = "2012-10-17"
|
|
2355
|
-
Statement =
|
|
2397
|
+
Statement = local.lambda_policy_statements
|
|
2356
2398
|
})
|
|
2357
2399
|
}
|
|
2358
2400
|
|
|
2401
|
+
locals {
|
|
2402
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
2403
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
2404
|
+
{
|
|
2405
|
+
Effect = "Allow"
|
|
2406
|
+
Action = [
|
|
2407
|
+
"appconfig:StartConfigurationSession",
|
|
2408
|
+
"appconfig:GetLatestConfiguration"
|
|
2409
|
+
]
|
|
2410
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
2411
|
+
}
|
|
2412
|
+
] : [], var.additional_iam_policy_statements)
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2359
2415
|
# CloudWatch Log Group for Lambda
|
|
2360
2416
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
2361
2417
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -3052,6 +3108,18 @@ variable "additional_iam_policy_statements" {
|
|
|
3052
3108
|
default = []
|
|
3053
3109
|
}
|
|
3054
3110
|
|
|
3111
|
+
variable "appconfig_application_id" {
|
|
3112
|
+
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."
|
|
3113
|
+
type = string
|
|
3114
|
+
default = null
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
variable "appconfig_application_arn" {
|
|
3118
|
+
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."
|
|
3119
|
+
type = string
|
|
3120
|
+
default = null
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3055
3123
|
variable "asset_bucket_name" {
|
|
3056
3124
|
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."
|
|
3057
3125
|
type = string
|
|
@@ -3234,7 +3302,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
3234
3302
|
|
|
3235
3303
|
environment {
|
|
3236
3304
|
variables = merge({
|
|
3237
|
-
}, var.
|
|
3305
|
+
}, var.appconfig_application_id != null ? {
|
|
3306
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
3307
|
+
} : {}, var.env)
|
|
3238
3308
|
}
|
|
3239
3309
|
|
|
3240
3310
|
tags = var.tags
|
|
@@ -3283,16 +3353,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
3283
3353
|
|
|
3284
3354
|
# Additional IAM policies for Lambda (if provided)
|
|
3285
3355
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
3286
|
-
count = length(
|
|
3356
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
3287
3357
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
3288
3358
|
role = aws_iam_role.lambda_execution_role.id
|
|
3289
3359
|
|
|
3290
3360
|
policy = jsonencode({
|
|
3291
3361
|
Version = "2012-10-17"
|
|
3292
|
-
Statement =
|
|
3362
|
+
Statement = local.lambda_policy_statements
|
|
3293
3363
|
})
|
|
3294
3364
|
}
|
|
3295
3365
|
|
|
3366
|
+
locals {
|
|
3367
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
3368
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
3369
|
+
{
|
|
3370
|
+
Effect = "Allow"
|
|
3371
|
+
Action = [
|
|
3372
|
+
"appconfig:StartConfigurationSession",
|
|
3373
|
+
"appconfig:GetLatestConfiguration"
|
|
3374
|
+
]
|
|
3375
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
3376
|
+
}
|
|
3377
|
+
] : [], var.additional_iam_policy_statements)
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3296
3380
|
# CloudWatch Log Group for Lambda
|
|
3297
3381
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
3298
3382
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -3728,6 +3812,18 @@ variable "additional_iam_policy_statements" {
|
|
|
3728
3812
|
default = []
|
|
3729
3813
|
}
|
|
3730
3814
|
|
|
3815
|
+
variable "appconfig_application_id" {
|
|
3816
|
+
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."
|
|
3817
|
+
type = string
|
|
3818
|
+
default = null
|
|
3819
|
+
}
|
|
3820
|
+
|
|
3821
|
+
variable "appconfig_application_arn" {
|
|
3822
|
+
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."
|
|
3823
|
+
type = string
|
|
3824
|
+
default = null
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3731
3827
|
variable "asset_bucket_name" {
|
|
3732
3828
|
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."
|
|
3733
3829
|
type = string
|
|
@@ -3910,7 +4006,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
3910
4006
|
|
|
3911
4007
|
environment {
|
|
3912
4008
|
variables = merge({
|
|
3913
|
-
}, var.
|
|
4009
|
+
}, var.appconfig_application_id != null ? {
|
|
4010
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
4011
|
+
} : {}, var.env)
|
|
3914
4012
|
}
|
|
3915
4013
|
|
|
3916
4014
|
tags = var.tags
|
|
@@ -3959,16 +4057,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
3959
4057
|
|
|
3960
4058
|
# Additional IAM policies for Lambda (if provided)
|
|
3961
4059
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
3962
|
-
count = length(
|
|
4060
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
3963
4061
|
name = "CustomApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
3964
4062
|
role = aws_iam_role.lambda_execution_role.id
|
|
3965
4063
|
|
|
3966
4064
|
policy = jsonencode({
|
|
3967
4065
|
Version = "2012-10-17"
|
|
3968
|
-
Statement =
|
|
4066
|
+
Statement = local.lambda_policy_statements
|
|
3969
4067
|
})
|
|
3970
4068
|
}
|
|
3971
4069
|
|
|
4070
|
+
locals {
|
|
4071
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
4072
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
4073
|
+
{
|
|
4074
|
+
Effect = "Allow"
|
|
4075
|
+
Action = [
|
|
4076
|
+
"appconfig:StartConfigurationSession",
|
|
4077
|
+
"appconfig:GetLatestConfiguration"
|
|
4078
|
+
]
|
|
4079
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
4080
|
+
}
|
|
4081
|
+
] : [], var.additional_iam_policy_statements)
|
|
4082
|
+
}
|
|
4083
|
+
|
|
3972
4084
|
# CloudWatch Log Group for Lambda
|
|
3973
4085
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
3974
4086
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|