File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -255,14 +255,18 @@ data "aws_iam_policy_document" "id_sync_policy_document" {
255255 ]
256256}
257257
258+ resource "aws_iam_policy" "id_sync_lambda_dynamodb_access_policy" {
259+ name = " ${ local . short_prefix } -id-sync-lambda-dynamodb-access-policy"
260+ description = " Allow Lambda to access DynamoDB"
261+ policy = data. aws_iam_policy_document . id_sync_policy_document . json
262+ }
263+
258264# Attach the dynamodb policy to the Lambda role
259- # TODO: attach a policy rather than a policy_arn?
260265resource "aws_iam_role_policy_attachment" "id_sync_lambda_dynamodb_policy_attachment" {
261266 role = aws_iam_role. id_sync_lambda_exec_role . name
262- policy = data . aws_iam_policy_document . id_sync_policy_document . json
267+ policy_arn = aws_iam_policy . id_sync_lambda_dynamodb_access_policy . arn
263268}
264269
265-
266270# Lambda Function with Security Group and VPC.
267271resource "aws_lambda_function" "id_sync_lambda" {
268272 function_name = " ${ local . short_prefix } -id_sync_lambda"
You can’t perform that action at this time.
0 commit comments