[Bug] ConditionAndBlock/ConditionOrBlock Not Allowed in Deeply Nested Policy Conditions in Terraform Provider #169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extended Network Access and Device Admin Policies for Nesting to 7 Levels
This PR extends ISE policy condition nesting from 3 levels to 7 levels (1 root + 6 nested children) for policy sets and rules in both Network Access and Device Administration domains.
This enhancement enables deeply nested conditional logic using
ConditionAndBlockandConditionOrBlockat all nesting levels.The 7-level nesting capability enables sophisticated access control policies that combine multiple logical operators at arbitrary depths, supporting complex organizational structures, multi-factor authentication scenarios, and granular network segmentation policies.
Resources Extended
Network Access Domain (5 resources):
ise_network_access_policy_setise_network_access_authentication_ruleise_network_access_authorization_ruleise_network_access_authorization_exception_ruleise_network_access_authorization_global_exception_ruleDevice Administration Domain (5 resources):
ise_device_admin_policy_setise_device_admin_authentication_ruleise_device_admin_authorization_ruleise_device_admin_authorization_exception_ruleise_device_admin_authorization_global_exception_ruleTotal: 10 provider resources + 10 corresponding data sources
Benefits
Policy Modeling Capabilities
(user in group A OR B) AND (device type X OR Y) AND (location Z) AND (time is business hours)Operational Improvements
Integration Benefits
Platform Compatibility
Validated against Cisco ISE 3.4
API Requirements
Technical Implementation
Provider Definition Files Extended
Updated YAML Definitions (
gen/definitions/):Network Access Policies:
Device Administration Policies:
Nesting Structure Added:
Each definition file extended with recursive children attributes:
children(Level 1)children_children(Level 2)children_children_children(Level 3)children_children_children_children(Level 4)children_children_children_children_children(Level 5)children_children_children_children_children_children(Level 6)Code Generation Updates
Generated Go Code:
Template Modifications:
gen/templates/model.go- Generate recursive nested structsgen/templates/resource.go- Process deep condition treesgen/templates/data_source.go- Retrieve nested conditionsProvider Configuration Enhancement
New Provider Parameter:
Why Extended Timeout:
Critical Bug Fix
Device Admin Policy Type Correction:
Reason: Terraform Sets don't preserve order, causing state drift with nested conditions. Lists maintain proper ordering and ensure idempotent operations.
Testing
Provider Compilation ✅
go vetand lintingmake gen) executes without errorsIntegration Testing ✅
Terraform Operations:
terraform plan- Correctly identifies 7-level nested conditionsterraform apply- Successfully deploys to ISE 3.4terraform refresh- No configuration drift detectedterraform destroy- Cleanly removes nested policiesISE API Validation:
Manual Device Verification:
Deployment Validation ✅
ISE 3.4 Node:
Network Access Policy Example:
Device Admin Policy Example:
Example Usage
Network Access - 7-Level Authorization Rule
Device Administration - 7-Level Policy Set
Performance Considerations
Recommended Provider Configuration
For policies with 5-7 levels of nesting:
Performance Impact:
Breaking Changes
None - This is a backward-compatible enhancement.
Existing policies with 1-3 levels of nesting continue to work without modification. The extension to 7 levels is additive.
Migration Notes
No migration required. Existing resources automatically gain 7-level nesting capability.
Checklist
Code Generation:
make gensuccessfullyBug Fixes:
request_timeoutparameter to providerTesting:
Documentation:
Deployment Notes
For Users:
request_timeout = 180or higher for deep nestingterraform planbefore deploying to production