-
Notifications
You must be signed in to change notification settings - Fork 0
/
vsan.tf
43 lines (42 loc) · 1.72 KB
/
vsan.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
#__________________________________________________________________
#
# Intersight VSAN Policy
# GUI Location: Policies > Create Policy > VSAN
#__________________________________________________________________
resource "intersight_fabric_fc_network_policy" "map" {
for_each = local.vsan
description = coalesce(each.value.description, "${each.value.name} VSAN Policy.")
enable_trunking = each.value.uplink_trunking
name = each.value.name
organization { moid = var.orgs[each.value.org] }
dynamic "tags" {
for_each = { for v in each.value.tags : v.key => v }
content {
key = tags.value.key
value = tags.value.value
}
}
}
#__________________________________________________________________
#
# Intersight > {VSAN Policy} > Edit > Add VSAN
# GUI Location: Policies > Create Policy > VSAN > Add VSAN
#__________________________________________________________________
resource "intersight_fabric_vsan" "map" {
depends_on = [
intersight_fabric_fc_network_policy.map
]
for_each = local.vsans
default_zoning = each.value.default_zoning
fcoe_vlan = each.value.fcoe_vlan_id
#fc_zone_sharing_mode = each.value.fc_zone_sharing_mode
name = length(compact([each.value.name])) > 0 ? each.value.name : length(
regexall("^[0-9]{4}$", each.value.vsan_id)) > 0 ? "VSAN${each.value.vsan_id}" : length(
regexall("^[0-9]{3}$", each.value.vsan_id)) > 0 ? "VSAN0${each.value.vsan_id}" : length(
regexall("^[0-9]{2}$", each.value.vsan_id)) > 0 ? "VSAN00${each.value.vsan_id}" : "VSAN000${each.value.vsan_id}"
vsan_id = each.value.vsan_id
vsan_scope = each.value.vsan_scope
fc_network_policy {
moid = intersight_fabric_fc_network_policy.map[each.value.vsan_policy].moid
}
}