forked from ohpensource/terraform-aws-ohp-ecr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam_roles.tf
23 lines (20 loc) · 927 Bytes
/
iam_roles.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
resource "aws_iam_role" "ecr_pull_role" {
count = local.create_pull_role
name = local.pull_iam_role_name
assume_role_policy = data.aws_iam_policy_document.assume_role_policy_pull.*.json[count.index]
}
resource "aws_iam_role" "ecr_push_role" {
count = local.create_push_role
name = local.push_iam_role_name
assume_role_policy = data.aws_iam_policy_document.assume_role_policy_push.*.json[count.index]
}
resource "aws_iam_role_policy_attachment" "ecr_pull_role" {
count = var.ecr_pull_role_policy_arn != null ? 1 : 0
role = aws_iam_role.ecr_pull_role.*.name[count.index]
policy_arn = var.ecr_pull_role_policy_arn
}
resource "aws_iam_role_policy_attachment" "ecr_push_role" {
count = var.ecr_push_role_policy_arn != null ? 1 : 0
role = aws_iam_role.ecr_push_role.*.name[count.index]
policy_arn = var.ecr_push_role_policy_arn
}