-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathassumed_role_permissions_boundary.tf
More file actions
81 lines (74 loc) · 1.86 KB
/
assumed_role_permissions_boundary.tf
File metadata and controls
81 lines (74 loc) · 1.86 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Policy document for Permissions boundary
data "aws_iam_policy_document" "assumed_role_permissions_boundary" {
#checkov:skip=CKV2_AWS_40: Ensure AWS IAM policy does not allow full IAM privileges
statement {
sid = "RestrictRegion"
effect = "Allow"
actions = [
"acm:*",
"application-autoscaling:*",
"apigateway:*",
"cloudtrail:*",
"cloudwatch:*",
"config:*",
"dynamodb:*",
"ec2:*",
"events:*",
"firehose:*",
"glue:*",
"health:*",
"iam:*",
"kms:*",
"lambda:*",
"logs:*",
"network-firewall:*",
"pipes:*",
"s3:*",
"schemas:*",
"sns:*",
"servicequotas:*",
"ssm:*",
"states:*",
"support:*",
"sqs:*",
"tag:*",
"trustedadvisor:*",
"xray:*"
]
resources = ["*"]
condition {
test = "StringEquals"
variable = "aws:RequestedRegion"
values = [var.default_aws_region]
}
}
statement {
sid = "DenyPrivEsculationViaIamRoles"
effect = "Deny"
actions = ["iam:*"]
resources = ["*"]
condition {
test = "ArnLike"
variable = "iam:PolicyARN"
values = ["arn:aws:iam::*:policy/${upper(var.project_name)}-*"]
}
}
statement {
sid = "DenyPrivEsculationViaIamProfiles"
effect = "Deny"
actions = ["iam:*"]
resources = ["arn:aws:iam::*:role/${upper(var.project_name)}-*"]
}
}
# Permissions Boundary policy
resource "aws_iam_policy" "assumed_role_permissions_boundary" {
name = "${local.stack_name}-${upper(var.project_name)}-PermissionsBoundary"
description = "Allows access to AWS services in the regions the client uses only"
policy = data.aws_iam_policy_document.assumed_role_permissions_boundary.json
tags = merge(
local.tags,
{
Stack = "api-layer"
}
)
}