-
Notifications
You must be signed in to change notification settings - Fork 1
/
iam.tf
45 lines (38 loc) · 1.43 KB
/
iam.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
resource "aws_iam_role" "0" {
name = "${local.project_name}-codepipeline"
assume_role_policy = "${file("${path.module}/role-codepipeline.json")}"
}
data "template_file" "0" {
template = "${file("${path.module}/policy-codepipeline.json.tpl")}"
vars {
arn_s3_bucket = "${aws_s3_bucket.0.arn}"
arn_codebuild = "${module.codebuild.id}"
arn_codebuild_integration_test = "${module.codebuild_integration_test.id}"
region = "${local.region}"
account_id = "${local.account_id}"
cluster = "${var.ecs_cluster}"
task_definition = "${var.ecs_task_definition}"
ecr_repo_arn = "${local.ecr_repo_arn}"
}
}
resource "aws_iam_role_policy" "0" {
role = "${aws_iam_role.0.name}"
policy = "${data.template_file.0.rendered}"
}
resource "aws_iam_role" "1" {
name = "${local.codebuild_iam_role_name}"
assume_role_policy = "${file("${path.module}/role-codebuild.json")}"
}
data "template_file" "1" {
template = "${file("${path.module}/policy-codebuild.json.tpl")}"
vars {
arn_s3_bucket = "${aws_s3_bucket.0.arn}"
region = "${local.region}"
account_id = "${local.account_id}"
ecr_repo_arn = "${local.ecr_repo_arn}"
}
}
resource "aws_iam_role_policy" "1" {
role = "${aws_iam_role.1.name}"
policy = "${data.template_file.1.rendered}"
}