|
| 1 | +#_________________________________________________________________________ |
| 2 | +# |
| 3 | +# FC Zone Policies |
| 4 | +# GUI Location: Configure > Policies > Create Policy > FC Zone |
| 5 | +#_________________________________________________________________________ |
| 6 | + |
| 7 | +variable "fc_zone_policies" { |
| 8 | + default = { |
| 9 | + default = { |
| 10 | + description = "" |
| 11 | + fc_target_zoning_type = "None" |
| 12 | + tags = [] |
| 13 | + targets = [] |
| 14 | + /* Example FC Target |
| 15 | + targets = [ |
| 16 | + { |
| 17 | + name = "example" |
| 18 | + switch_id = "A" |
| 19 | + vsan_id = 100 |
| 20 | + wwpn = "20:00:00:25:B5:0A:00:00" |
| 21 | + } |
| 22 | + ] */ |
| 23 | + } |
| 24 | + } |
| 25 | + description = <<-EOT |
| 26 | + key - Name of the FC Zoning Policy |
| 27 | + * description - Description for the Policy. |
| 28 | + * fc_target_zoning_type - Default is "None". Type of FC zoning. Allowed values are SIST, SIMT and None. |
| 29 | + - None - FC zoning is not configured. |
| 30 | + - SIMT - The system automatically creates one zone for each vHBA. Configure this type of zoning if the number of zones created is likely to exceed the maximum supported number of zones. |
| 31 | + - SIST - The system automatically creates one zone for each vHBA and storage port pair. Each zone has two members. |
| 32 | + * tags - Default is []. List of Key/Value Pairs to Assign as Attributes to the Policy. |
| 33 | + * targets - Default is []. A List of FC Target Details to assign to the Policy |
| 34 | + - name - Name given to the target member. |
| 35 | + - Gold |
| 36 | + - switch_id - Unique identifier for the Fabric object. |
| 37 | + * A - Switch Identifier of Fabric Interconnect A. |
| 38 | + * B - Switch Identifier of Fabric Interconnect B. |
| 39 | + - vsan_id - VSAN with scope defined as Storage in the VSAN policy. |
| 40 | + - wwpn - WWPN that is a member of the FC zone. |
| 41 | + EOT |
| 42 | + type = map(object( |
| 43 | + { |
| 44 | + description = optional(string) |
| 45 | + fc_target_zoning_type = optional(string) |
| 46 | + tags = optional(list(map(string))) |
| 47 | + targets = list(object( |
| 48 | + { |
| 49 | + name = string |
| 50 | + switch_id = string |
| 51 | + vsan_id = number |
| 52 | + wwpn = string |
| 53 | + } |
| 54 | + )) |
| 55 | + } |
| 56 | + )) |
| 57 | +} |
| 58 | + |
| 59 | +#_______________________________________________________________________________ |
| 60 | +# |
| 61 | +# FC Zone Policies |
| 62 | +# GUI Location: Configure > Policies > Create Policy > FC Zone |
| 63 | +#_______________________________________________________________________________ |
| 64 | + |
| 65 | +resource "intersight_fabric_fc_zone_policy" "fc_zone_policies" { |
| 66 | + depends_on = [ |
| 67 | + local.org_moid |
| 68 | + ] |
| 69 | + for_each = local.fc_zone_policies |
| 70 | + description = each.value.description != "" ? each.value.description : "${each.key} FC Zone Policy" |
| 71 | + fc_target_zoning_type = each.value.fc_target_zoning_type |
| 72 | + name = each.key |
| 73 | + organization { |
| 74 | + moid = local.org_moid |
| 75 | + object_type = "organization.Organization" |
| 76 | + } |
| 77 | + dynamic "fc_target_members" { |
| 78 | + for_each = each.value.targets |
| 79 | + content { |
| 80 | + name = fc_target_members.key |
| 81 | + switch_id = fc_target_members.value.switch_id |
| 82 | + vsan_id = fc_target_members.value.vsan_id |
| 83 | + wwpn = fc_target_members.value.wwpn |
| 84 | + } |
| 85 | + } |
| 86 | + dynamic "tags" { |
| 87 | + for_each = length(each.value.tags) > 0 ? each.value.tags : local.tags |
| 88 | + content { |
| 89 | + key = tags.value.key |
| 90 | + value = tags.value.value |
| 91 | + } |
| 92 | + } |
| 93 | +} |
0 commit comments