-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathmain.roleassignment.tf
37 lines (36 loc) · 1.63 KB
/
main.roleassignment.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
# The roleassignments module creates role assignments from the data
# supplied in the var.role_assignments variable
module "roleassignment" {
source = "./modules/roleassignment"
depends_on = [
module.resourcegroup_networkwatcherrg,
module.resourcegroup,
module.subscription,
module.usermanagedidentity,
module.virtualnetwork,
]
for_each = { for k, v in var.role_assignments : k => v if var.role_assignment_enabled }
role_assignment_principal_id = each.value.principal_id
role_assignment_definition = each.value.definition
role_assignment_scope = "${local.subscription_resource_id}${each.value.relative_scope}"
role_assignment_condition = each.value.condition
role_assignment_condition_version = each.value.condition_version
}
# The roleassignments_umi module creates role assignments from the data
# supplied in the var.umi_role_assignments variable
module "roleassignment_umi" {
source = "./modules/roleassignment"
depends_on = [
module.resourcegroup_networkwatcherrg,
module.resourcegroup,
module.subscription,
module.usermanagedidentity,
module.virtualnetwork,
]
for_each = { for k, v in var.umi_role_assignments : k => v if var.umi_enabled }
role_assignment_principal_id = one(module.usermanagedidentity).principal_id
role_assignment_definition = each.value.definition
role_assignment_scope = "${local.subscription_resource_id}${each.value.relative_scope}"
role_assignment_condition = each.value.condition
role_assignment_condition_version = each.value.condition_version
}