forked from studionone/terraform-aws-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam.tf
20 lines (18 loc) · 609 Bytes
/
iam.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
resource "aws_iam_role" "backup_role" {
name = "${var.project}-${var.env}-backup-role"
assume_role_policy = data.aws_iam_policy_document.backup_assume_role_policy.json
}
data "aws_iam_policy_document" "backup_assume_role_policy" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["backup.amazonaws.com"]
}
}
}
resource "aws_iam_role_policy_attachment" "backup_policy_attachment" {
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForBackup"
role = "${aws_iam_role.backup_role.name}"
}