plan apply enforcement - hyperfocus/porc GitHub Wiki
Plan-Then-Apply Enforcement in PORC
PORC enforces that a valid plan
must run before any apply
operation. This includes:
- Checking Mongo for a plan run matching the external ID
- Validating that the plan has not expired (time-based TTL)
- Verifying the plan matches the current blueprint hash
- Enforcing approval (if required) before
apply
Metadata Keys Used
external_id
: Provided by GitHub or Portplan_status
: Recorded as 'success', 'failure', 'skipped'approval_required
: Boolean flagapproval_record
: Optional change record ID (e.g., ServiceNow)
Enforcement Logic
- If
plan_status
!= 'success' → reject apply - If
approval_required
= true → block untilapproval_record
is present and validated
Blueprint Lifecycle (PORC and TFE)
pine submit
→ sends blueprint to PORCpine build
→ PORC renders templates and uploads to TFE as config versionpine plan
→ triggers a remote TFE planpine apply
→ applies the changes if approved
Sentinel policies are enforced during TFE plan/apply runs.