@@ -5,6 +5,22 @@ resource "ise_user_identity_group" "user_identity_group" {
5
5
description = try (each. value . description , local. defaults . ise . identity_management . user_identity_groups . description , null )
6
6
}
7
7
8
+ locals {
9
+ user_identity_groups = distinct (flatten ([
10
+ for user in try (local. ise . identity_management . internal_users , []) : [
11
+ for group in try (user. user_identity_groups , []) : group
12
+ ]
13
+ ]))
14
+ }
15
+
16
+ data "ise_user_identity_group" "user_identity_group" {
17
+ for_each = toset (local. user_identity_groups )
18
+
19
+ name = each. value
20
+
21
+ depends_on = [ise_user_identity_group . user_identity_group ]
22
+ }
23
+
8
24
resource "ise_internal_user" "internal_user" {
9
25
for_each = { for user in try (local. ise . identity_management . internal_users , []) : user . name => user }
10
26
@@ -18,32 +34,64 @@ resource "ise_internal_user" "internal_user" {
18
34
first_name = try (each. value . first_name , local. defaults . ise . identity_management . internal_users . first_name , null )
19
35
last_name = try (each. value . last_name , local. defaults . ise . identity_management . internal_users . last_name , null )
20
36
change_password = try (each. value . change_password , local. defaults . ise . identity_management . internal_users . change_password , null )
21
- identity_groups = length (try (each. value . user_identity_groups , [])) > 0 ? join (" ," , [for i in try (each. value . user_identity_groups , []) : ise_user_identity_group . user_identity_group [i ]. id ]) : null
37
+ identity_groups = length (try (each. value . user_identity_groups , [])) > 0 ? join (" ," , [for i in try (each. value . user_identity_groups , []) : data . ise_user_identity_group . user_identity_group [i ]. id ]) : null
22
38
password_never_expires = try (each. value . password_never_expires , local. defaults . ise . identity_management . internal_users . password_never_expires , null )
23
39
password_id_store = try (each. value . password_id_store , local. defaults . ise . identity_management . internal_users . password_id_store , null )
24
40
25
41
depends_on = [ise_user_identity_group . user_identity_group ]
26
42
}
27
43
28
44
locals {
29
- endpoint_identity_groups = { for group in try (local. ise . identity_management . endpoint_identity_groups , []) : group . name => group }
30
- endpoint_identity_groups_with_parent = { for k , v in local . endpoint_identity_groups : k => v if try (v. parent_group , " " ) != " " }
45
+ endpoint_identity_groups = { for group in try (local. ise . identity_management . endpoint_identity_groups , []) : group . name => group }
46
+ endpoint_identity_groups_with_parent = [for k , v in local . endpoint_identity_groups : v . parent_group if try (v. parent_group , " " ) != " " ]
47
+ endpoint_identity_groups_in_endpoints = [for endpoint in try (local. ise . identity_management . endpoints , []) : endpoint . endpoint_identity_group if try (endpoint. endpoint_identity_group , " " ) != " " ]
31
48
}
32
49
33
50
data "ise_endpoint_identity_group" "endpoint_identity_group" {
34
- for_each = local. endpoint_identity_groups_with_parent
51
+ for_each = toset ( concat ( local. endpoint_identity_groups_with_parent , local . endpoint_identity_groups_in_endpoints ))
35
52
36
- name = each. value . parent_group
53
+ name = each. value
37
54
}
38
55
39
56
resource "ise_endpoint_identity_group" "endpoint_identity_group" {
40
57
for_each = local. endpoint_identity_groups
41
58
42
59
name = each. key
43
- parent_endpoint_identity_group_id = try (data. ise_endpoint_identity_group . endpoint_identity_group [each . key ]. id , null )
60
+ parent_endpoint_identity_group_id = try (data. ise_endpoint_identity_group . endpoint_identity_group [each . value . parent_group ]. id , null )
44
61
description = try (each. value . description , local. defaults . ise . identity_management . endpoint_identity_groups . description , null )
45
62
}
46
63
64
+ resource "ise_endpoint" "endpoint" {
65
+ for_each = { for endpoint in try (local. ise . identity_management . endpoints , []) : endpoint . mac => endpoint }
66
+
67
+ name = each. key
68
+ mac = each. key
69
+ description = try (each. value . description , local. defaults . ise . identity_management . endpoints . description , null )
70
+ static_profile_assignment = try (each. value . static_profile_assignment , local. defaults . ise . identity_management . endpoints . static_profile_assignment , null )
71
+ static_group_assignment = try (each. value . static_group_assignment , local. defaults . ise . identity_management . endpoints . static_group_assignment , null )
72
+ group_id = try (ise_endpoint_identity_group. endpoint_identity_group [each . value . endpoint_identity_group ]. id , data. ise_endpoint_identity_group . endpoint_identity_group [each . value . endpoint_identity_group ]. id , null )
73
+ static_profile_assignment_defined = try (each. value . static_profile_assignment_defined , local. defaults . ise . identity_management . endpoints . static_profile_assignment_defined , null )
74
+ static_group_assignment_defined = try (each. value . static_group_assignment_defined , local. defaults . ise . identity_management . endpoints . static_group_assignment_defined , null )
75
+ identity_store = try (each. value . identity_store , local. defaults . ise . identity_management . endpoints . identity_store , null )
76
+ identity_store_id = try (each. value . identity_store_id , local. defaults . ise . identity_management . endpoints . identity_store_id , null )
77
+ portal_user = try (each. value . portal_user , local. defaults . ise . identity_management . endpoints . portal_user , null )
78
+ profile_id = try (each. value . profile_id , local. defaults . ise . identity_management . endpoints . profile_id , null )
79
+ custom_attributes = try (each. value . custom_attributes , local. defaults . ise . identity_management . endpoints . custom_attributes , null )
80
+ mdm_compliance_status = try (each. value . mdm_attributes . compliance_status , local. defaults . ise . identity_management . endpoints . mdm_attributes . compliance_status , null )
81
+ mdm_encrypted = try (each. value . mdm_attributes . encrypted , local. defaults . ise . identity_management . endpoints . mdm_attributes . encrypted , null )
82
+ mdm_enrolled = try (each. value . mdm_attributes . enrolled , local. defaults . ise . identity_management . endpoints . mdm_attributes . enrolled , null )
83
+ mdm_imei = try (each. value . mdm_attributes . imei , local. defaults . ise . identity_management . endpoints . mdm_attributes . imei , null )
84
+ mdm_jail_broken = try (each. value . mdm_attributes . jail_broken , local. defaults . ise . identity_management . endpoints . mdm_attributes . jail_broken , null )
85
+ mdm_manufacturer = try (each. value . mdm_attributes . manufacturer , local. defaults . ise . identity_management . endpoints . mdm_attributes . manufacturer , null )
86
+ mdm_model = try (each. value . mdm_attributes . model , local. defaults . ise . identity_management . endpoints . mdm_attributes . model , null )
87
+ mdm_os = try (each. value . mdm_attributes . os , local. defaults . ise . identity_management . endpoints . mdm_attributes . os , null )
88
+ mdm_phone_number = try (each. value . mdm_attributes . phone_number , local. defaults . ise . identity_management . endpoints . mdm_attributes . phone_number , null )
89
+ mdm_pinlock = try (each. value . mdm_attributes . pin_lock , local. defaults . ise . identity_management . endpoints . mdm_attributes . pin_lock , null )
90
+ mdm_reachable = try (each. value . mdm_attributes . reachable , local. defaults . ise . identity_management . endpoints . mdm_attributes . reachable , null )
91
+ mdm_serial = try (each. value . mdm_attributes . serial , local. defaults . ise . identity_management . endpoints . mdm_attributes . serial , null )
92
+ mdm_server_name = try (each. value . mdm_attributes . server_name , local. defaults . ise . identity_management . endpoints . mdm_attributes . server_name , null )
93
+ }
94
+
47
95
resource "ise_certificate_authentication_profile" "certificate_authentication_profile" {
48
96
for_each = { for profile in try (local. ise . identity_management . certificate_authentication_profiles , []) : profile . name => profile }
49
97
0 commit comments