-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnagios_role.tf
34 lines (26 loc) · 961 Bytes
/
nagios_role.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
# Nagios
resource "aws_iam_role" "nagios_iam_role" {
count = var.create_nagios_role ? 1 : 0
name = "nagios_cloudwatch_read_access_role"
assume_role_policy = data.aws_iam_policy_document.nagios_policy_document[0].json
}
data "aws_iam_policy_document" "nagios_policy_document" {
count = var.create_nagios_role ? 1 : 0
statement {
actions = ["sts:AssumeRole"]
principals {
type = "AWS"
identifiers = var.nagios_role_arn
}
}
}
resource "aws_iam_role_policy_attachment" "nagios_cloudwatch_read" {
count = var.create_nagios_role ? 1 : 0
policy_arn = "arn:aws:iam::aws:policy/CloudWatchReadOnlyAccess"
role = aws_iam_role.nagios_iam_role[0].name
}
resource "aws_iam_role_policy_attachment" "nagios_cloudwatch_budget_read" {
count = var.create_nagios_budget_role ? 1 : 0
policy_arn = "arn:aws:iam::aws:policy/AWSBudgetsReadOnlyAccess"
role = aws_iam_role.nagios_iam_role[0].name
}