Skip to content

Commit 0f8e093

Browse files
committed
fix(iam): move to full ARN for stability
1 parent 88a8d76 commit 0f8e093

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

iam.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ resource "aws_cloudformation_stack" "lambda_permissions" {
33
template_body = jsonencode({
44
Resources = merge([
55
for urlPath, config in local.definition : {
6-
for httpMethod, definition in config : "AllowExecutionFromAPIGateway${substr(sha256("${upper(httpMethod)} ${urlPath} "), 0, 8)}" => {
6+
for httpMethod, definition in config : "AllowExecutionFromAPIGateway${substr(sha256("${upper(httpMethod)} ${urlPath}"), 0, 8)}" => {
77
Type = "AWS::Lambda::Permission"
88
Properties = {
99
FunctionName = definition.lambda.function_name
@@ -31,7 +31,7 @@ data "aws_iam_policy_document" "vpc_invoke" {
3131
identifiers = ["*"]
3232
}
3333
actions = ["execute-api:Invoke"]
34-
resources = ["execute-api:/${statement.value}/*/*"]
34+
resources = ["arn:aws:execute-api:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${aws_rest_api.this.id}/${statement.value}/*/*"]
3535
condition {
3636
test = "StringNotEquals"
3737
variable = "aws:sourceVpc"
@@ -49,7 +49,7 @@ data "aws_iam_policy_document" "vpc_invoke" {
4949
identifiers = ["*"]
5050
}
5151
actions = ["execute-api:Invoke"]
52-
resources = ["execute-api:/${statement.value}/*/*"]
52+
resources = ["arn:aws:execute-api:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${aws_rest_api.this.id}/${statement.value}/*/*"]
5353
}
5454
}
5555
}

0 commit comments

Comments
 (0)