Skip to content

Instantly share code, notes, and snippets.

@ferzerkerx
Created June 10, 2021 09:18
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 ferzerkerx/34927ec175fc4e25ed4e83ff02b7e855 to your computer and use it in GitHub Desktop.
Save ferzerkerx/34927ec175fc4e25ed4e83ff02b7e855 to your computer and use it in GitHub Desktop.
dynamodb-access
# DynamoDB
data "aws_iam_policy_document" "tables" {
statement {
actions = ["dynamodb:*"]
resources = ["${var.table_arns}"]
}
}
resource "aws_iam_policy" "tables_policy" {
name = "dynamodb-access-from-${var.app_name}"
path = "/"
policy = "${data.aws_iam_policy_document.tables.json}"
}
resource "aws_iam_policy_attachment" "tables_access" {
name = "dynamodb-access-from-${var.app_name}-attachment"
roles = ["${var.app_role_name}"]
policy_arn = "${aws_iam_policy.tables_policy.arn}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment