-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
32 lines (28 loc) · 1.08 KB
/
main.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
resource "aws_codecommit_repository" "this" {
repository_name = var.repository_name
description = var.repository_description
tags = var.tags
}
resource "aws_codecommit_approval_rule_template" "this" {
count = var.create_approval_rules ? 1 : 0
name = "${var.repository_name} approval rule"
description = "This is an approval rule for ${var.repository_name}"
content = var.approval_rules
}
resource "aws_codecommit_approval_rule_template_association" "this" {
count = var.create_approval_rules ? 1 : 0
approval_rule_template_name = aws_codecommit_approval_rule_template.this[0].name
repository_name = aws_codecommit_repository.this.repository_name
}
resource "aws_codecommit_trigger" "this" {
count = var.create_triggers ? 1 : 0
repository_name = aws_codecommit_repository.this.repository_name
dynamic "trigger" {
for_each = var.triggers
content {
name = trigger.value.Name
events = trigger.value.Events
destination_arn = trigger.value.DestinationArn
}
}
}