-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdata.tf
48 lines (41 loc) · 1.07 KB
/
data.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
data "aws_iam_policy_document" "assume_role_policy" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "AWS"
identifiers = [var.trusted_user_arn]
}
condition {
test = "StringEquals"
variable = "sts:ExternalId"
values = [var.external_id]
}
}
}
data "aws_iam_policy_document" "internal_users" {
statement {
actions = ["s3:ListAllMyBuckets"]
resources = ["arn:aws:s3:::*"]
effect = "Allow"
}
statement {
sid = "InternalUsersS3all"
actions = ["s3:*"]
resources = [aws_s3_bucket.important-bucket.arn]
effect = "Allow"
}
}
data "aws_iam_policy_document" "contractors1" {
statement {
actions = ["s3:GetObject", "s3:GetObjectVersion"]
resources = [aws_s3_bucket.contractors-bucket.arn]
effect = "Allow"
}
}
data "template_file" "josh_policy" {
template = file("${path.module}/iam_policies/${var.environment}_policy.json")
vars = {
bucket_name = aws_s3_bucket.important-bucket.id
principal = aws_iam_user.internal_user.arn
}
}