-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam_policy.tf
83 lines (72 loc) · 2.5 KB
/
iam_policy.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
data "aws_iam_policy_document" "ecrAdministrator" {
statement {
actions = ["ecr:*"]
resources = ["arn:aws:ecr:ap-southeast-1:773504329195:repository/sensayai/coreservice"]
effect = "Allow"
}
}
data "aws_iam_policy_document" "iamAdministrator" {
statement {
actions = ["iam:*"]
resources = ["*"]
effect = "Allow"
}
}
data "aws_iam_policy_document" "cloudFormationAdministrator" {
statement {
actions = ["cloudformation:*"]
resources = ["*"]
effect = "Allow"
}
}
data "aws_iam_policy_document" "s3Developer" {
statement {
actions = ["s3:*"]
resources = ["*"]
effect = "Allow"
}
}
resource "aws_iam_group_policy_attachment" "attach-ecr-policy-dev-group" {
count = local.is_production
group = aws_iam_group.developers[0].name
policy_arn = aws_iam_policy.ECRAdministrator[0].arn
}
resource "aws_iam_group_policy_attachment" "attach-s3-policy-dev-group" {
count = local.is_production
group = aws_iam_group.developers[0].name
policy_arn = aws_iam_policy.S3Developer[0].arn
}
resource "aws_iam_group_policy_attachment" "attach-iam-policy-admin-group" {
count = local.is_production
group = aws_iam_group.admins[0].name
policy_arn = aws_iam_policy.IAMAdministrator[0].arn
}
resource "aws_iam_group_policy_attachment" "attach-cloudformation-policy-admin-group" {
count = local.is_production
group = aws_iam_group.admins[0].name
policy_arn = aws_iam_policy.CloudFormationAdministrator[0].arn
}
resource "aws_iam_policy" "ECRAdministrator" {
count = local.is_production
name = "ECRAdministrator-policy"
description = "Provide some access to AWS ECR service"
policy = data.aws_iam_policy_document.ecrAdministrator.json
}
resource "aws_iam_policy" "IAMAdministrator" {
count = local.is_production
name = "IAMAdministrator-policy"
description = "Provide some access to AWS IAM service"
policy = data.aws_iam_policy_document.iamAdministrator.json
}
resource "aws_iam_policy" "CloudFormationAdministrator" {
count = local.is_production
name = "CloudFormationAdministrator-policy"
description = "Provide some access to CloudFormation service"
policy = data.aws_iam_policy_document.cloudFormationAdministrator.json
}
resource "aws_iam_policy" "S3Developer" {
count = local.is_production
name = "S3Developer-policy"
description = "S3 full access policy for developers"
policy = data.aws_iam_policy_document.s3Developer.json
}