-
Notifications
You must be signed in to change notification settings - Fork 0
/
10_api-gateway.tf
48 lines (40 loc) · 1.2 KB
/
10_api-gateway.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
resource "aws_iam_role_policy" "api_gateway_access" {
name = "api-gateway-access"
role = aws_iam_role.api_gateway_access.id
policy = data.aws_iam_policy_document.api_gateway_access.json
}
resource "aws_iam_role" "api_gateway_access" {
name = "ap-gateway-access"
assume_role_policy = templatefile("templates/api_gateway_access_assume_role_policy.tpl", {
IDENTITY_POOL_ID = aws_cognito_identity_pool.main.id
})
}
data "aws_iam_policy_document" "api_gateway_access" {
version = "2012-10-17"
statement {
actions = [
"execute-api:Invoke"
]
effect = "Allow"
resources = ["arn:aws:execute-api:*:*:*"]
}
}
resource "aws_iam_role_policy" "deny_everything" {
name = "deny_everything"
role = aws_iam_role.deny_everything.id
policy = data.aws_iam_policy_document.deny_everything.json
}
resource "aws_iam_role" "deny_everything" {
name = "deny_everything"
assume_role_policy = templatefile("templates/deny_everything_assume_role_policy.tpl", {
IDENTITY_POOL_ID = aws_cognito_identity_pool.main.id
})
}
data "aws_iam_policy_document" "deny_everything" {
version = "2012-10-17"
statement {
actions = ["*"]
effect = "Deny"
resources = ["*"]
}
}