@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
|
@@ -3421,6 +3421,18 @@ variable "additional_iam_policy_statements" {
|
|
|
3421
3421
|
default = []
|
|
3422
3422
|
}
|
|
3423
3423
|
|
|
3424
|
+
variable "appconfig_application_id" {
|
|
3425
|
+
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."
|
|
3426
|
+
type = string
|
|
3427
|
+
default = null
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3430
|
+
variable "appconfig_application_arn" {
|
|
3431
|
+
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."
|
|
3432
|
+
type = string
|
|
3433
|
+
default = null
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3424
3436
|
variable "asset_bucket_name" {
|
|
3425
3437
|
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."
|
|
3426
3438
|
type = string
|
|
@@ -3594,7 +3606,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
3594
3606
|
|
|
3595
3607
|
environment {
|
|
3596
3608
|
variables = merge({
|
|
3597
|
-
}, var.
|
|
3609
|
+
}, var.appconfig_application_id != null ? {
|
|
3610
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
3611
|
+
} : {}, var.env)
|
|
3598
3612
|
}
|
|
3599
3613
|
|
|
3600
3614
|
tags = var.tags
|
|
@@ -3643,16 +3657,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
3643
3657
|
|
|
3644
3658
|
# Additional IAM policies for Lambda (if provided)
|
|
3645
3659
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
3646
|
-
count = length(
|
|
3660
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
3647
3661
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
3648
3662
|
role = aws_iam_role.lambda_execution_role.id
|
|
3649
3663
|
|
|
3650
3664
|
policy = jsonencode({
|
|
3651
3665
|
Version = "2012-10-17"
|
|
3652
|
-
Statement =
|
|
3666
|
+
Statement = local.lambda_policy_statements
|
|
3653
3667
|
})
|
|
3654
3668
|
}
|
|
3655
3669
|
|
|
3670
|
+
locals {
|
|
3671
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
3672
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
3673
|
+
{
|
|
3674
|
+
Effect = "Allow"
|
|
3675
|
+
Action = [
|
|
3676
|
+
"appconfig:StartConfigurationSession",
|
|
3677
|
+
"appconfig:GetLatestConfiguration"
|
|
3678
|
+
]
|
|
3679
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
3680
|
+
}
|
|
3681
|
+
] : [], var.additional_iam_policy_statements)
|
|
3682
|
+
}
|
|
3683
|
+
|
|
3656
3684
|
# CloudWatch Log Group for Lambda
|
|
3657
3685
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
3658
3686
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -4125,6 +4153,18 @@ variable "additional_iam_policy_statements" {
|
|
|
4125
4153
|
default = []
|
|
4126
4154
|
}
|
|
4127
4155
|
|
|
4156
|
+
variable "appconfig_application_id" {
|
|
4157
|
+
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."
|
|
4158
|
+
type = string
|
|
4159
|
+
default = null
|
|
4160
|
+
}
|
|
4161
|
+
|
|
4162
|
+
variable "appconfig_application_arn" {
|
|
4163
|
+
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."
|
|
4164
|
+
type = string
|
|
4165
|
+
default = null
|
|
4166
|
+
}
|
|
4167
|
+
|
|
4128
4168
|
variable "asset_bucket_name" {
|
|
4129
4169
|
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."
|
|
4130
4170
|
type = string
|
|
@@ -4298,7 +4338,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
4298
4338
|
|
|
4299
4339
|
environment {
|
|
4300
4340
|
variables = merge({
|
|
4301
|
-
}, var.
|
|
4341
|
+
}, var.appconfig_application_id != null ? {
|
|
4342
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
4343
|
+
} : {}, var.env)
|
|
4302
4344
|
}
|
|
4303
4345
|
|
|
4304
4346
|
tags = var.tags
|
|
@@ -4347,16 +4389,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
4347
4389
|
|
|
4348
4390
|
# Additional IAM policies for Lambda (if provided)
|
|
4349
4391
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
4350
|
-
count = length(
|
|
4392
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
4351
4393
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
4352
4394
|
role = aws_iam_role.lambda_execution_role.id
|
|
4353
4395
|
|
|
4354
4396
|
policy = jsonencode({
|
|
4355
4397
|
Version = "2012-10-17"
|
|
4356
|
-
Statement =
|
|
4398
|
+
Statement = local.lambda_policy_statements
|
|
4357
4399
|
})
|
|
4358
4400
|
}
|
|
4359
4401
|
|
|
4402
|
+
locals {
|
|
4403
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
4404
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
4405
|
+
{
|
|
4406
|
+
Effect = "Allow"
|
|
4407
|
+
Action = [
|
|
4408
|
+
"appconfig:StartConfigurationSession",
|
|
4409
|
+
"appconfig:GetLatestConfiguration"
|
|
4410
|
+
]
|
|
4411
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
4412
|
+
}
|
|
4413
|
+
] : [], var.additional_iam_policy_statements)
|
|
4414
|
+
}
|
|
4415
|
+
|
|
4360
4416
|
# CloudWatch Log Group for Lambda
|
|
4361
4417
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
4362
4418
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -4911,6 +4967,18 @@ variable "additional_iam_policy_statements" {
|
|
|
4911
4967
|
default = []
|
|
4912
4968
|
}
|
|
4913
4969
|
|
|
4970
|
+
variable "appconfig_application_id" {
|
|
4971
|
+
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."
|
|
4972
|
+
type = string
|
|
4973
|
+
default = null
|
|
4974
|
+
}
|
|
4975
|
+
|
|
4976
|
+
variable "appconfig_application_arn" {
|
|
4977
|
+
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."
|
|
4978
|
+
type = string
|
|
4979
|
+
default = null
|
|
4980
|
+
}
|
|
4981
|
+
|
|
4914
4982
|
variable "asset_bucket_name" {
|
|
4915
4983
|
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."
|
|
4916
4984
|
type = string
|
|
@@ -5084,7 +5152,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
5084
5152
|
|
|
5085
5153
|
environment {
|
|
5086
5154
|
variables = merge({
|
|
5087
|
-
}, var.
|
|
5155
|
+
}, var.appconfig_application_id != null ? {
|
|
5156
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
5157
|
+
} : {}, var.env)
|
|
5088
5158
|
}
|
|
5089
5159
|
|
|
5090
5160
|
tags = var.tags
|
|
@@ -5133,16 +5203,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
5133
5203
|
|
|
5134
5204
|
# Additional IAM policies for Lambda (if provided)
|
|
5135
5205
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
5136
|
-
count = length(
|
|
5206
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
5137
5207
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
5138
5208
|
role = aws_iam_role.lambda_execution_role.id
|
|
5139
5209
|
|
|
5140
5210
|
policy = jsonencode({
|
|
5141
5211
|
Version = "2012-10-17"
|
|
5142
|
-
Statement =
|
|
5212
|
+
Statement = local.lambda_policy_statements
|
|
5143
5213
|
})
|
|
5144
5214
|
}
|
|
5145
5215
|
|
|
5216
|
+
locals {
|
|
5217
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
5218
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
5219
|
+
{
|
|
5220
|
+
Effect = "Allow"
|
|
5221
|
+
Action = [
|
|
5222
|
+
"appconfig:StartConfigurationSession",
|
|
5223
|
+
"appconfig:GetLatestConfiguration"
|
|
5224
|
+
]
|
|
5225
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
5226
|
+
}
|
|
5227
|
+
] : [], var.additional_iam_policy_statements)
|
|
5228
|
+
}
|
|
5229
|
+
|
|
5146
5230
|
# CloudWatch Log Group for Lambda
|
|
5147
5231
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
5148
5232
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -5621,6 +5705,18 @@ variable "additional_iam_policy_statements" {
|
|
|
5621
5705
|
default = []
|
|
5622
5706
|
}
|
|
5623
5707
|
|
|
5708
|
+
variable "appconfig_application_id" {
|
|
5709
|
+
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."
|
|
5710
|
+
type = string
|
|
5711
|
+
default = null
|
|
5712
|
+
}
|
|
5713
|
+
|
|
5714
|
+
variable "appconfig_application_arn" {
|
|
5715
|
+
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."
|
|
5716
|
+
type = string
|
|
5717
|
+
default = null
|
|
5718
|
+
}
|
|
5719
|
+
|
|
5624
5720
|
variable "asset_bucket_name" {
|
|
5625
5721
|
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."
|
|
5626
5722
|
type = string
|
|
@@ -5803,7 +5899,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
5803
5899
|
|
|
5804
5900
|
environment {
|
|
5805
5901
|
variables = merge({
|
|
5806
|
-
}, var.
|
|
5902
|
+
}, var.appconfig_application_id != null ? {
|
|
5903
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
5904
|
+
} : {}, var.env)
|
|
5807
5905
|
}
|
|
5808
5906
|
|
|
5809
5907
|
tags = var.tags
|
|
@@ -5852,16 +5950,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
5852
5950
|
|
|
5853
5951
|
# Additional IAM policies for Lambda (if provided)
|
|
5854
5952
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
5855
|
-
count = length(
|
|
5953
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
5856
5954
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
5857
5955
|
role = aws_iam_role.lambda_execution_role.id
|
|
5858
5956
|
|
|
5859
5957
|
policy = jsonencode({
|
|
5860
5958
|
Version = "2012-10-17"
|
|
5861
|
-
Statement =
|
|
5959
|
+
Statement = local.lambda_policy_statements
|
|
5862
5960
|
})
|
|
5863
5961
|
}
|
|
5864
5962
|
|
|
5963
|
+
locals {
|
|
5964
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
5965
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
5966
|
+
{
|
|
5967
|
+
Effect = "Allow"
|
|
5968
|
+
Action = [
|
|
5969
|
+
"appconfig:StartConfigurationSession",
|
|
5970
|
+
"appconfig:GetLatestConfiguration"
|
|
5971
|
+
]
|
|
5972
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
5973
|
+
}
|
|
5974
|
+
] : [], var.additional_iam_policy_statements)
|
|
5975
|
+
}
|
|
5976
|
+
|
|
5865
5977
|
# CloudWatch Log Group for Lambda
|
|
5866
5978
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
5867
5979
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -6559,6 +6671,18 @@ variable "additional_iam_policy_statements" {
|
|
|
6559
6671
|
default = []
|
|
6560
6672
|
}
|
|
6561
6673
|
|
|
6674
|
+
variable "appconfig_application_id" {
|
|
6675
|
+
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."
|
|
6676
|
+
type = string
|
|
6677
|
+
default = null
|
|
6678
|
+
}
|
|
6679
|
+
|
|
6680
|
+
variable "appconfig_application_arn" {
|
|
6681
|
+
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."
|
|
6682
|
+
type = string
|
|
6683
|
+
default = null
|
|
6684
|
+
}
|
|
6685
|
+
|
|
6562
6686
|
variable "asset_bucket_name" {
|
|
6563
6687
|
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."
|
|
6564
6688
|
type = string
|
|
@@ -6741,7 +6865,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
6741
6865
|
|
|
6742
6866
|
environment {
|
|
6743
6867
|
variables = merge({
|
|
6744
|
-
}, var.
|
|
6868
|
+
}, var.appconfig_application_id != null ? {
|
|
6869
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
6870
|
+
} : {}, var.env)
|
|
6745
6871
|
}
|
|
6746
6872
|
|
|
6747
6873
|
tags = var.tags
|
|
@@ -6790,16 +6916,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
6790
6916
|
|
|
6791
6917
|
# Additional IAM policies for Lambda (if provided)
|
|
6792
6918
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
6793
|
-
count = length(
|
|
6919
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
6794
6920
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
6795
6921
|
role = aws_iam_role.lambda_execution_role.id
|
|
6796
6922
|
|
|
6797
6923
|
policy = jsonencode({
|
|
6798
6924
|
Version = "2012-10-17"
|
|
6799
|
-
Statement =
|
|
6925
|
+
Statement = local.lambda_policy_statements
|
|
6800
6926
|
})
|
|
6801
6927
|
}
|
|
6802
6928
|
|
|
6929
|
+
locals {
|
|
6930
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
6931
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
6932
|
+
{
|
|
6933
|
+
Effect = "Allow"
|
|
6934
|
+
Action = [
|
|
6935
|
+
"appconfig:StartConfigurationSession",
|
|
6936
|
+
"appconfig:GetLatestConfiguration"
|
|
6937
|
+
]
|
|
6938
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
6939
|
+
}
|
|
6940
|
+
] : [], var.additional_iam_policy_statements)
|
|
6941
|
+
}
|
|
6942
|
+
|
|
6803
6943
|
# CloudWatch Log Group for Lambda
|
|
6804
6944
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
6805
6945
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -7496,6 +7636,18 @@ variable "additional_iam_policy_statements" {
|
|
|
7496
7636
|
default = []
|
|
7497
7637
|
}
|
|
7498
7638
|
|
|
7639
|
+
variable "appconfig_application_id" {
|
|
7640
|
+
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."
|
|
7641
|
+
type = string
|
|
7642
|
+
default = null
|
|
7643
|
+
}
|
|
7644
|
+
|
|
7645
|
+
variable "appconfig_application_arn" {
|
|
7646
|
+
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."
|
|
7647
|
+
type = string
|
|
7648
|
+
default = null
|
|
7649
|
+
}
|
|
7650
|
+
|
|
7499
7651
|
variable "asset_bucket_name" {
|
|
7500
7652
|
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."
|
|
7501
7653
|
type = string
|
|
@@ -7678,7 +7830,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
7678
7830
|
|
|
7679
7831
|
environment {
|
|
7680
7832
|
variables = merge({
|
|
7681
|
-
}, var.
|
|
7833
|
+
}, var.appconfig_application_id != null ? {
|
|
7834
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
7835
|
+
} : {}, var.env)
|
|
7682
7836
|
}
|
|
7683
7837
|
|
|
7684
7838
|
tags = var.tags
|
|
@@ -7727,16 +7881,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
7727
7881
|
|
|
7728
7882
|
# Additional IAM policies for Lambda (if provided)
|
|
7729
7883
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
7730
|
-
count = length(
|
|
7884
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
7731
7885
|
name = "TestApiHandler-additional-policies-\${random_string.suffix.result}"
|
|
7732
7886
|
role = aws_iam_role.lambda_execution_role.id
|
|
7733
7887
|
|
|
7734
7888
|
policy = jsonencode({
|
|
7735
7889
|
Version = "2012-10-17"
|
|
7736
|
-
Statement =
|
|
7890
|
+
Statement = local.lambda_policy_statements
|
|
7737
7891
|
})
|
|
7738
7892
|
}
|
|
7739
7893
|
|
|
7894
|
+
locals {
|
|
7895
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
7896
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
7897
|
+
{
|
|
7898
|
+
Effect = "Allow"
|
|
7899
|
+
Action = [
|
|
7900
|
+
"appconfig:StartConfigurationSession",
|
|
7901
|
+
"appconfig:GetLatestConfiguration"
|
|
7902
|
+
]
|
|
7903
|
+
Resource = ["\${var.appconfig_application_arn}/*"]
|
|
7904
|
+
}
|
|
7905
|
+
] : [], var.additional_iam_policy_statements)
|
|
7906
|
+
}
|
|
7907
|
+
|
|
7740
7908
|
# CloudWatch Log Group for Lambda
|
|
7741
7909
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
7742
7910
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -38,6 +38,18 @@ variable "additional_iam_policy_statements" {
|
|
|
38
38
|
default = []
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
variable "appconfig_application_id" {
|
|
42
|
+
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."
|
|
43
|
+
type = string
|
|
44
|
+
default = null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
variable "appconfig_application_arn" {
|
|
48
|
+
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."
|
|
49
|
+
type = string
|
|
50
|
+
default = null
|
|
51
|
+
}
|
|
52
|
+
|
|
41
53
|
variable "asset_bucket_name" {
|
|
42
54
|
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."
|
|
43
55
|
type = string
|
|
@@ -231,7 +243,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
231
243
|
AWS_LWA_INVOKE_MODE = "buffered"
|
|
232
244
|
AWS_LAMBDA_EXEC_WRAPPER = "/opt/bootstrap"
|
|
233
245
|
<%_ } _%>
|
|
234
|
-
}, var.
|
|
246
|
+
}, var.appconfig_application_id != null ? {
|
|
247
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
248
|
+
} : {}, var.env)
|
|
235
249
|
}
|
|
236
250
|
|
|
237
251
|
tags = var.tags
|
|
@@ -280,16 +294,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
280
294
|
|
|
281
295
|
# Additional IAM policies for Lambda (if provided)
|
|
282
296
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
283
|
-
count = length(
|
|
297
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
284
298
|
name = "<%- apiNameClassName %>Handler-additional-policies-${random_string.suffix.result}"
|
|
285
299
|
role = aws_iam_role.lambda_execution_role.id
|
|
286
300
|
|
|
287
301
|
policy = jsonencode({
|
|
288
302
|
Version = "2012-10-17"
|
|
289
|
-
Statement =
|
|
303
|
+
Statement = local.lambda_policy_statements
|
|
290
304
|
})
|
|
291
305
|
}
|
|
292
306
|
|
|
307
|
+
locals {
|
|
308
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
309
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
310
|
+
{
|
|
311
|
+
Effect = "Allow"
|
|
312
|
+
Action = [
|
|
313
|
+
"appconfig:StartConfigurationSession",
|
|
314
|
+
"appconfig:GetLatestConfiguration"
|
|
315
|
+
]
|
|
316
|
+
Resource = ["${var.appconfig_application_arn}/*"]
|
|
317
|
+
}
|
|
318
|
+
] : [], var.additional_iam_policy_statements)
|
|
319
|
+
}
|
|
320
|
+
|
|
293
321
|
# CloudWatch Log Group for Lambda
|
|
294
322
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
295
323
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -38,6 +38,18 @@ variable "additional_iam_policy_statements" {
|
|
|
38
38
|
default = []
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
variable "appconfig_application_id" {
|
|
42
|
+
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."
|
|
43
|
+
type = string
|
|
44
|
+
default = null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
variable "appconfig_application_arn" {
|
|
48
|
+
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."
|
|
49
|
+
type = string
|
|
50
|
+
default = null
|
|
51
|
+
}
|
|
52
|
+
|
|
41
53
|
variable "asset_bucket_name" {
|
|
42
54
|
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."
|
|
43
55
|
type = string
|
|
@@ -240,7 +252,9 @@ resource "aws_lambda_function" "api_lambda" {
|
|
|
240
252
|
AWS_LWA_INVOKE_MODE = "response_stream"
|
|
241
253
|
AWS_LAMBDA_EXEC_WRAPPER = "/opt/bootstrap"
|
|
242
254
|
<%_ } _%>
|
|
243
|
-
}, var.
|
|
255
|
+
}, var.appconfig_application_id != null ? {
|
|
256
|
+
RUNTIME_CONFIG_APP_ID = var.appconfig_application_id
|
|
257
|
+
} : {}, var.env)
|
|
244
258
|
}
|
|
245
259
|
|
|
246
260
|
tags = var.tags
|
|
@@ -289,16 +303,30 @@ resource "aws_iam_role_policy_attachment" "lambda_vpc_access" {
|
|
|
289
303
|
|
|
290
304
|
# Additional IAM policies for Lambda (if provided)
|
|
291
305
|
resource "aws_iam_role_policy" "lambda_additional_policies" {
|
|
292
|
-
count = length(
|
|
306
|
+
count = length(local.lambda_policy_statements) > 0 ? 1 : 0
|
|
293
307
|
name = "<%- apiNameClassName %>Handler-additional-policies-${random_string.suffix.result}"
|
|
294
308
|
role = aws_iam_role.lambda_execution_role.id
|
|
295
309
|
|
|
296
310
|
policy = jsonencode({
|
|
297
311
|
Version = "2012-10-17"
|
|
298
|
-
Statement =
|
|
312
|
+
Statement = local.lambda_policy_statements
|
|
299
313
|
})
|
|
300
314
|
}
|
|
301
315
|
|
|
316
|
+
locals {
|
|
317
|
+
# Grant read access to the runtime-config AppConfig application when wired
|
|
318
|
+
lambda_policy_statements = concat(var.appconfig_application_arn != null ? [
|
|
319
|
+
{
|
|
320
|
+
Effect = "Allow"
|
|
321
|
+
Action = [
|
|
322
|
+
"appconfig:StartConfigurationSession",
|
|
323
|
+
"appconfig:GetLatestConfiguration"
|
|
324
|
+
]
|
|
325
|
+
Resource = ["${var.appconfig_application_arn}/*"]
|
|
326
|
+
}
|
|
327
|
+
] : [], var.additional_iam_policy_statements)
|
|
328
|
+
}
|
|
329
|
+
|
|
302
330
|
# CloudWatch Log Group for Lambda
|
|
303
331
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
304
332
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|