Skip to content

Commit 7bd3a34

Browse files
Add endpoint support and default user identity groups in internal users (#11)
1 parent ddddb9b commit 7bd3a34

File tree

6 files changed

+68
-9
lines changed

6 files changed

+68
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.1.2 (unreleased)
2+
3+
- Added endpoints resource support
4+
- Added support for default user identity groups assignment under internal users
5+
- Fix description attribute of `network_device_groups_children_children`
6+
17
## 0.1.1
28

39
- Fix issue with error due to missing settings for `allowed_protocols` and EAP-TLS stateless session resume

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module "ise" {
4444
| Name | Version |
4545
|------|---------|
4646
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
47-
| <a name="requirement_ise"></a> [ise](#requirement\_ise) | >= 0.1.14 |
47+
| <a name="requirement_ise"></a> [ise](#requirement\_ise) | >= 0.2.0 |
4848
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 2.3.0 |
4949
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.10.0 |
5050
| <a name="requirement_utils"></a> [utils](#requirement\_utils) | >= 0.2.5 |
@@ -176,6 +176,7 @@ module "ise" {
176176
| [ise_device_admin_policy_set.device_admin_policy_set_9](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/resources/device_admin_policy_set) | resource |
177177
| [ise_device_admin_time_and_date_condition.device_admin_time_and_date_condition](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/resources/device_admin_time_and_date_condition) | resource |
178178
| [ise_downloadable_acl.downloadable_acl](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/resources/downloadable_acl) | resource |
179+
| [ise_endpoint.endpoint](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/resources/endpoint) | resource |
179180
| [ise_endpoint_identity_group.endpoint_identity_group](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/resources/endpoint_identity_group) | resource |
180181
| [ise_identity_source_sequence.identity_source_sequences](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/resources/identity_source_sequence) | resource |
181182
| [ise_internal_user.internal_user](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/resources/internal_user) | resource |
@@ -311,6 +312,7 @@ module "ise" {
311312
| [ise_network_access_condition.network_access_condition_circular](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/data-sources/network_access_condition) | data source |
312313
| [ise_trustsec_security_group.trustsec_security_group](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/data-sources/trustsec_security_group) | data source |
313314
| [ise_trustsec_security_group_acl.trustsec_security_group_acl](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/data-sources/trustsec_security_group_acl) | data source |
315+
| [ise_user_identity_group.user_identity_group](https://registry.terraform.io/providers/CiscoDevNet/ise/latest/docs/data-sources/user_identity_group) | data source |
314316
| [utils_yaml_merge.defaults](https://registry.terraform.io/providers/netascode/utils/latest/docs/data-sources/yaml_merge) | data source |
315317
| [utils_yaml_merge.model](https://registry.terraform.io/providers/netascode/utils/latest/docs/data-sources/yaml_merge) | data source |
316318
## Modules

defaults/defaults.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ defaults:
2929
send_configuration_to_device_using: DISABLE_ALL
3030
include_when_deploying_sgt_updates: false
3131
identity_management:
32+
endpoints:
33+
static_group_assignment_defined: true
34+
static_profile_assignment_defined: true
3235
internal_users:
3336
enabled: true
3437
change_password: true

ise_identity_management.tf

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ resource "ise_user_identity_group" "user_identity_group" {
55
description = try(each.value.description, local.defaults.ise.identity_management.user_identity_groups.description, null)
66
}
77

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+
824
resource "ise_internal_user" "internal_user" {
925
for_each = { for user in try(local.ise.identity_management.internal_users, []) : user.name => user }
1026

@@ -18,32 +34,64 @@ resource "ise_internal_user" "internal_user" {
1834
first_name = try(each.value.first_name, local.defaults.ise.identity_management.internal_users.first_name, null)
1935
last_name = try(each.value.last_name, local.defaults.ise.identity_management.internal_users.last_name, null)
2036
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
2238
password_never_expires = try(each.value.password_never_expires, local.defaults.ise.identity_management.internal_users.password_never_expires, null)
2339
password_id_store = try(each.value.password_id_store, local.defaults.ise.identity_management.internal_users.password_id_store, null)
2440

2541
depends_on = [ise_user_identity_group.user_identity_group]
2642
}
2743

2844
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, "") != ""]
3148
}
3249

3350
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))
3552

36-
name = each.value.parent_group
53+
name = each.value
3754
}
3855

3956
resource "ise_endpoint_identity_group" "endpoint_identity_group" {
4057
for_each = local.endpoint_identity_groups
4158

4259
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)
4461
description = try(each.value.description, local.defaults.ise.identity_management.endpoint_identity_groups.description, null)
4562
}
4663

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+
4795
resource "ise_certificate_authentication_profile" "certificate_authentication_profile" {
4896
for_each = { for profile in try(local.ise.identity_management.certificate_authentication_profiles, []) : profile.name => profile }
4997

ise_network_resources.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ locals {
3939
for c in try(p.children, []) : [
4040
for c2 in try(c.children, []) : {
4141
name = try(split("#", p.path)[0] == "All Device Types", false) ? "Device Type#${p.path}#${p.name}#${c.name}#${c2.name}" : (try(split("#", p.path)[0] == "All Locations", false) ? "Location#${p.path}#${p.name}#${c.name}#${c2.name}" : (try(split("#", p.path)[0] == "Is IPSEC Device", false) ? "IPSEC#${p.path}" : (try(p.path, null) == null ? "${p.name}#${p.name}#${c.name}#${c2.name}" : "${split("#", p.path)[0]}#${p.path}#${p.name}#${c.name}#${c2.name}")))
42-
description = try(c.description, local.defaults.ise.network_resources.network_device_groups.children.description, null)
42+
description = try(c2.description, local.defaults.ise.network_resources.network_device_groups.children.description, null)
4343
root_group = try(split("#", p.path)[0] == "All Device Types", false) ? "Device Type" : (try(split("#", p.path)[0] == "All Locations", false) ? "Location" : (try(split("#", p.path)[0] == "Is IPSEC Device", false) ? "IPSEC" : try(split("#", p.path)[0], p.name)))
4444
}
4545
]

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
ise = {
66
source = "CiscoDevNet/ise"
7-
version = ">= 0.1.14"
7+
version = ">= 0.2.0"
88
}
99
utils = {
1010
source = "netascode/utils"

0 commit comments

Comments
 (0)