-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
93 lines (89 loc) · 4.54 KB
/
main.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#_________________________________________________________________________________________
#
# Data Model Merge Process - Merge YAML Files into HCL Format
#_________________________________________________________________________________________
data "utils_yaml_merge" "model" {
input = concat([
for file in fileset(path.module, "*.ezi.yaml") : file(file)], [
for file in fileset(path.module, "o*/*.ezi.yaml") : file(file)], [
for file in fileset(path.module, "p*/*.ezi.yaml") : file(file)], [
for file in fileset(path.module, "t*/*.ezi.yaml") : file(file)]
)
merge_list_items = false
}
#_________________________________________________________________________________________
#
# Intersight:Organizations
# GUI Location: Settings > Organizations/Resource Groups
#_________________________________________________________________________________________
module "organizations" {
# source = "/home/tyscott/terraform-cisco-modules/terraform-intersight-organizations"
source = "terraform-cisco-modules/organizations/intersight"
version = "4.2.11-18370"
for_each = { for i in ["map"] : i => i if length([setsubtract(keys(local.model), local.non_orgs)]) > 0 }
global_settings = local.global_settings
model = { for k, v in local.model : k => v if length(regexall("^global_settings|intersight$", k)) == 0 }
}
#_________________________________________________________________________________________
#
# Intersight:Pools
# GUI Location: Infrastructure Service > Configure > Pools
#_________________________________________________________________________________________
module "pools" {
# source = "/home/tyscott/terraform-cisco-modules/terraform-intersight-pools"
source = "terraform-cisco-modules/pools/intersight"
version = "4.2.11-18370"
for_each = {
for i in ["map"] : i => i if length(flatten([for org in setsubtract(keys(local.model), local.non_orgs) : [
for e in keys(lookup(local.model[org], "pools", {})) : e]])) > 0 || length(
flatten([for org in setsubtract(keys(local.model), local.non_orgs) : [for e in lookup(lookup(local.model[org], "profiles", {}), "server", []) : [
for d in e["targets"] : lookup(d, "reservations", [])
]]])
) > 0
}
global_settings = local.global_settings
model = { for k, v in local.model : k => v if length(regexall("^global_settings|intersight$", k)) == 0 }
orgs = module.organizations["map"].organizations
}
#_________________________________________________________________________________________
#
# Intersight:Policies
# GUI Location: Infrastructure Service > Configure > Policies
#_________________________________________________________________________________________
module "policies" {
# source = "/home/tyscott/terraform-cisco-modules/terraform-intersight-policies"
source = "terraform-cisco-modules/policies/intersight"
version = "4.2.11-18370"
for_each = {
for i in ["map"] : i => i if length(flatten([for org in keys(local.model) : [
for e in keys(lookup(local.model[org], "policies", {})) : local.model[org].policies[e] if length(lookup(lookup(
local.model[org], "policies", {}), e, [])) > 0]])
) > 0
}
global_settings = local.global_settings
model = { for k, v in local.model : k => v if length(regexall("^global_settings|intersight$", k)) == 0 }
orgs = module.organizations["map"].organizations
policies_sensitive = local.policies_sensitive
pools = module.pools
}
#_________________________________________________________________________________________
#
# Intersight: UCS Chassis, Domain, and Server Profiles/Templates
# GUI Location: Infrastructure Service > Configure > Profiles
# GUI Location: Infrastructure Service > Configure > Templates
#_________________________________________________________________________________________
module "profiles" {
# source = "/home/tyscott/terraform-cisco-modules/terraform-intersight-profiles"
source = "terraform-cisco-modules/profiles/intersight"
version = "4.2.11-18370"
for_each = {
for i in ["map"] : i => i if length(flatten([for org in keys(local.model) : [for e in ["profiles", "templates"] : [
for d in ["chassis", "domain", "server"] : lookup(lookup(local.model[org], e, {}), d, [])]]]
)) > 0
}
global_settings = local.global_settings
model = { for k, v in local.model : k => v if length(regexall("^global_settings|intersight$", k)) == 0 }
orgs = module.organizations["map"].organizations
policies = module.policies
pools = module.pools
}