Skip to content

Commit 90c2f7e

Browse files
authored
Merge pull request #37 from SPHTech-Platform/chore/decouple-perms
decouple addPermissions
2 parents 1b39e22 + 6e1c3f6 commit 90c2f7e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

data.tf

+11-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ data "aws_iam_policy_document" "update_lambda" {
2323
sid = "LambdaUpdateEvent"
2424

2525
actions = [
26-
"lambda:AddPermission",
2726
"lambda:UpdateFunctionCode",
2827
"lambda:UpdateFunctionConfiguration",
2928
"lambda:UpdateAlias",
@@ -46,6 +45,17 @@ data "aws_iam_policy_document" "update_lambda" {
4645
resources = ["arn:aws:apigateway:${data.aws_region.current.name}::/restapis/${var.apigw_id}/*"]
4746
}
4847
}
48+
49+
dynamic "statement" {
50+
for_each = var.enable_version_identifier ? [1] : []
51+
content {
52+
sid = "AllowLambdaAddPermissions"
53+
actions = [
54+
"lambda:AddPermission",
55+
]
56+
resources = ["arn:aws:lambda:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:function:${var.function_prefix}*"]
57+
}
58+
}
4959
}
5060

5161
data "aws_iam_policy_document" "update_lambda_combined" {

0 commit comments

Comments
 (0)