File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ data "aws_iam_policy_document" "update_lambda" {
23
23
sid = " LambdaUpdateEvent"
24
24
25
25
actions = [
26
+ " lambda:AddPermission" ,
26
27
" lambda:UpdateFunctionCode" ,
27
28
" lambda:UpdateFunctionConfiguration" ,
28
29
" lambda:UpdateAlias" ,
@@ -33,6 +34,20 @@ data "aws_iam_policy_document" "update_lambda" {
33
34
]
34
35
resources = [" arn:aws:lambda:${ data . aws_region . current . name } :${ data . aws_caller_identity . current . account_id } :function:${ var . function_prefix } *" ]
35
36
}
37
+
38
+ dynamic "statement" {
39
+ for_each = var. enable_version_identifier ? [1 ] : []
40
+ content {
41
+ sid = " AllowApiGatewayInvoke"
42
+ actions = [
43
+ " apigateway:POST" ,
44
+ " apigateway:PUT" ,
45
+ ]
46
+ resources = [
47
+ var . apigw_arn ,
48
+ ]
49
+ }
50
+ }
36
51
}
37
52
38
53
data "aws_iam_policy_document" "update_lambda_combined" {
Original file line number Diff line number Diff line change @@ -457,3 +457,16 @@ variable "function_tags" {
457
457
type = map (string )
458
458
default = {}
459
459
}
460
+
461
+ # to allow deployments with api gateway triggers and update version whenever there is new deployment
462
+ variable "enable_version_identifier" {
463
+ description = " Enable version identifier for lambda function"
464
+ type = bool
465
+ default = false
466
+ }
467
+
468
+ variable "apigw_arn" {
469
+ description = " API Gateway ARN"
470
+ type = string
471
+ default = null
472
+ }
You can’t perform that action at this time.
0 commit comments