Created
January 23, 2023 14:45
-
-
Save gungoren/72b91fd0bb17bb7ba2f37b8d3fac4f99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_iam_policy_document" "search_role_policy" { | |
version = "2012-10-17" | |
statement { | |
effect = "Allow" | |
actions = [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents", | |
"rekognition:DescribeCollection", | |
"rekognition:SearchFacesByImage", | |
"dynamodb:GetItem", | |
] | |
resources = [ | |
"arn:aws:logs:*:*:*", | |
"arn:aws:rekognition:*:*:collection/${var.collection_id}", | |
"arn:aws:dynamodb:*:*:table/${local.table_name}" | |
] | |
} | |
} | |
resource "aws_iam_role" "search_function" { | |
name = "faces-search-function-lambda-role" | |
assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json | |
} | |
resource "aws_iam_role_policy" "search_function" { | |
name = "cloudwatch_search" | |
role = aws_iam_role.search_function.id | |
policy = data.aws_iam_policy_document.search_role_policy.json | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment