-
Notifications
You must be signed in to change notification settings - Fork 0
/
iqn.tf
45 lines (43 loc) · 1.7 KB
/
iqn.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
#____________________________________________________________
#
# Intersight IQN Pool Resource
# GUI Location: Pools > Create Pool
#____________________________________________________________
resource "intersight_iqnpool_pool" "map" {
for_each = local.iqn
assignment_order = each.value.assignment_order
description = each.value.description != "" ? each.value.description : "${each.value.name} IQN Pool."
name = each.value.name
prefix = each.value.prefix
dynamic "iqn_suffix_blocks" {
for_each = { for v in each.value.iqn_blocks : v.from => v }
content {
from = iqn_suffix_blocks.value.from
object_type = "iqnpool.IqnSuffixBlock"
size = iqn_suffix_blocks.value.size
suffix = iqn_suffix_blocks.value.suffix
to = iqn_suffix_blocks.value.to
}
}
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
}
}
}
resource "intersight_iqnpool_reservation" "map" {
depends_on = [intersight_iqnpool_pool.map]
for_each = { for v in local.reservations : "${v.pool_name}/${v.identity}" => v if v.identity_type == "iqn" }
allocation_type = each.value.allocation_type # dynamic|static
identity = each.value.identity
organization { moid = var.orgs[each.value.org] }
dynamic "pool" {
for_each = { for v in [each.value.pool_name] : v => v if each.value.allocation_type == "dynamic" }
content {
moid = contains(local.pools.iqn.moids, pool.value) ? intersight_iqnpool_pool.map[pool.value].moid : local.pools_data.iqn[pool.value].moid
}
}
}