-
Notifications
You must be signed in to change notification settings - Fork 1
/
db.tf
67 lines (58 loc) · 1.64 KB
/
db.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
resource "aws_dynamodb_table" "url_actions" {
name = local.dynamodb_url_action_table_name
billing_mode = "PAY_PER_REQUEST"
table_class = "STANDARD"
stream_enabled = false
hash_key = "url"
attribute {
name = "url"
type = "S"
}
}
data "aws_iam_policy_document" "origin_req_dynamodb" {
version = "2012-10-17"
statement {
effect = "Allow"
resources = [
"${aws_dynamodb_table.url_actions.arn}",
"${aws_dynamodb_table.url_actions.arn}/index"
]
actions = [
"dynamodb:GetItem",
]
}
}
resource "aws_iam_policy" "origin_req_dynamodb" {
name = "${var.iam_role_prefix}-access-dynamodb-from-origin-req-lambda"
policy = data.aws_iam_policy_document.origin_req_dynamodb.json
}
# data "aws_iam_policy_document" "url_action_table_manage" {
# version = "2012-10-17"
# statement {
# resources = [
# "${aws_dynamodb_table.url_actions.arn}",
# "${aws_dynamodb_table.url_actions.arn}/index"
# ]
# actions = [
# "dynamodb:PutItem",
# "dynamodb:UpdateItem",
# "dynamodb:DeleteItem",
# "dynamodb:BatchWriteItem",
# "dynamodb:GetItem",
# "dynamodb:BatchGetItem",
# "dynamodb:Scan",
# "dynamodb:Query",
# "dynamodb:ConditionCheckItem"
# ]
# }
# }
# resource "aws_iam_user" "middleware_admin" {
# name = "middleware-admin"
# }
# resource "aws_iam_access_key" "middleware_admin" {
# user = aws_iam_user.middleware_admin.name
# }
# resource "aws_iam_user_policy_attachment" "test-attach" {
# user = aws_iam_user.middleware_admin.name
# policy_arn = data.aws_iam_policy_document.url_action_table_manage.json
# }