-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorganizations.tf
41 lines (39 loc) · 1.34 KB
/
organizations.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
#____________________________________________________________
#
# Intersight Organizations
# GUI Location: System > Organizations
#____________________________________________________________
data "intersight_organization_organization" "map" {
}
resource "intersight_organization_organization" "map" {
depends_on = [intersight_resource_group.map]
for_each = local.organization
description = each.value.description != "" ? each.value.description : "${each.value.name} Organization."
name = each.value.name
dynamic "resource_groups" {
for_each = { for v in each.value.resource_groups : v.name => v }
content {
moid = intersight_resource_group.map[resource_groups.value.name].moid
object_type = "resource.Group"
}
}
dynamic "tags" {
for_each = { for v in each.value.tags : v.key => v }
content {
key = tags.value.key
value = tags.value.value
}
}
}
resource "intersight_iam_sharing_rule" "map" {
depends_on = [intersight_organization_organization.map]
for_each = local.shared_organizations
shared_resource {
moid = intersight_organization_organization.map[each.value.org].moid
object_type = "organization.Organization"
}
shared_with_resource {
moid = local.organizations_data[each.value.shared].moid
object_type = "organization.Organization"
}
}