-
Notifications
You must be signed in to change notification settings - Fork 3
/
inventory_role.tf
46 lines (42 loc) · 1.04 KB
/
inventory_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
35
36
37
38
39
40
41
42
43
44
45
46
resource "aws_iam_role" "valtix_inventory_role" {
name = "${var.prefix}-inventory-role"
tags = {
Name = "${var.prefix}-inventory-role"
prefix = var.prefix
}
assume_role_policy = jsonencode({
Version = "2012-10-17",
Statement = [
{
Action = "sts:AssumeRole",
Principal = {
Service = "events.amazonaws.com"
},
Effect = "Allow"
}
]
})
}
resource "aws_iam_role_policy" "valtix_inventory_policy" {
name = "${var.prefix}-inventory-policy"
role = aws_iam_role.valtix_inventory_role.id
policy = jsonencode({
Version = "2012-10-17",
Statement = [
{
Action = "events:PutEvents",
Effect = "Allow",
Resource = [
"arn:aws:events:*:${var.controller_aws_account_number}:event-bus/default"
]
},
{
Action = "events:InvokeApiDestination",
Effect = "Allow",
Resource = [
"arn:aws:events:*:${data.aws_caller_identity.current.account_id}:api-destination/*"
]
}
]
})
}