Skip to content

Instantly share code, notes, and snippets.

@diogoaurelio
Created September 16, 2018 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diogoaurelio/5f8628684126230d1b72fac55685d76d to your computer and use it in GitHub Desktop.
Save diogoaurelio/5f8628684126230d1b72fac55685d76d to your computer and use it in GitHub Desktop.
lambda_permissions.tf
################################################################################
# AWS Lambda IAM Policy document definitions
################################################################################
data "aws_iam_policy_document" "this" {
statement {
effect = "Allow"
actions = [
"s3:GetBucketLocation",
"s3:ListAllMyBuckets",
]
resources = [
"*",
]
}
statement {
effect = "Allow"
actions = [
"s3:Get*",
"s3:List*",
"s3:Describe*",
"s3:RestoreObject",
]
resources = [
"*",
]
}
# Required if Lambda is created inside VPC
statement {
effect = "Allow"
actions = [
"ec2:DescribeNetworkInterfaces",
"ec2:CreateNetworkInterface",
"ec2:DeleteNetworkInterface",
]
resources = [
"*",
]
}
# Required if lambda requires specific Secrets from AWS SSM
statement {
effect = "Allow"
actions = [
"ssm:GetParameter",
]
resources = [
"${aws_ssm_parameter.redshift_lambda_db_password.arn}",
]
}
# Required if using encrypted data
statement {
effect = "Allow"
actions = [
"kms:ListKeys",
"kms:Encrypt",
"kms:Decrypt",
]
resources = [
"*",
]
}
statement {
effect = "Allow"
actions = [
"sns:Publish",
]
resources = [
"${aws_sns_topic.lambda_sns_dql.arn}",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment