feat: add policy operations commands for Sentinel policy evaluation#187
Open
CloudbrokerAz wants to merge 1 commit intohashicorp:mainfrom
Open
feat: add policy operations commands for Sentinel policy evaluation#187CloudbrokerAz wants to merge 1 commit intohashicorp:mainfrom
CloudbrokerAz wants to merge 1 commit intohashicorp:mainfrom
Conversation
This adds two new commands to tfci for working with Sentinel policies: - policy show: Retrieve and display policy evaluation results - policy override: Apply policy overrides with justification Key features: - Supports both modern (task-stages) and legacy (policy-checks) TFC APIs - Displays actual policy names using PolicySetOutcomes API - Automatic retry with exponential backoff for policy evaluation - Pipeline-agnostic output format (works with any CI/CD system) - Comprehensive test coverage
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR adds two new commands to
tfcifor automating Sentinel policy evaluation and override operations in CI/CD pipelines.Why this change?
Currently,
tfcilacks commands for handling Sentinel policy evaluations, forcing users to manually check policy results in the TFC UI or build custom API integrations. This creates friction in automated deployment workflows, particularly when:This change adds native support for policy operations, enabling fully automated policy workflows while maintaining proper governance and audit trails.
Commands Added:
policy show- Retrieves and displays Sentinel policy evaluation results for a run--no-waitoption to disable)policy override- Applies policy overrides with justification for audit complianceTesting plan
Unit Tests
All tests pass successfully:
End-to-End Testing
Tested against real TFC organization (cloudbrokeraz/it-ops-api-automation):
Expected output:
requires_overrideboolean flagtfci -organization cloudbrokeraz policy override \ --run run-abc123def456 \ --justification "Emergency hotfix approved by CTO - INC-12345" \ --jsonExpected output:
Code Quality
External links
Audit Trail Enhancement:
--justificationparameter