data "aws_iam_policy_document" "policy_portal_data_sync_lambda" { statement { effect = "Allow" actions = [ "ec2:CreateNetworkInterface", "logs:CreateLogStream", "ec2:DescribeNetworkInterfaces", "logs:DescribeLogStreams", "ec2:DeleteNetworkInterface", "logs:PutRetentionPolicy", "logs:CreateLogGroup", "logs:PutLogEvents" ] resources = ["*"] } } resource "aws_iam_policy" "policy_portal_data_sync_lambda" { name = "policy_portal_data_sync_lambda" path = "/" policy = data.aws_iam_policy_document.policy_portal_data_sync_lambda.json description = "IAM policy for portal_data_sync_lambda" } resource "aws_iam_role" "portal-lambda-role" { name = "portal-data-sync-lambda-role" assume_role_policy = <