CPG: TFERunPlanApply sub-flow does not handle Terraform Cloud API errors — calling stack remains in "running" state<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Issue The OOTB TFERunPlanApply sub-flow in Cloud Provisioning and Governance (CPG) lacks error handling around the Terraform Cloud REST API calls. When the "get state version" step times out (or any HTTP-level error occurs against the Terraform Cloud endpoint), the sub-flow throws an unhandled exception and exits without returning a terminal status to the calling CPG/CSC flow. The parent stack record remains in running state indefinitely. Symptoms CPG/CSC provisioning request submitted via Cloud Service Catalog appears to hang.Stack record remains in running state with no progression.sys_flow_context for TFERunPlanApply shows a failed step (typically the Terraform Cloud "get state version" call) with a connection timeout or HTTP error.No error message is surfaced to the calling flow or the customer's request record.Cancelling or retrying the stack via the CPG UI is not possible — the stack appears still in-flight. Cause The OOTB TFERunPlanApply sub-flow does not wrap the Terraform Cloud REST API calls in error handling. On any HTTP-level failure (timeout, HTTP 5xx, connection refused), the sub-flow throws an unhandled exception and terminates without: Setting an output status of failedCapturing the error messageReturning control to the calling CPG/CSC flow The calling flow therefore never receives a terminal response, and the stack record's state field is never updated. Resolution Apply the update set delivered via case CS9094472 — wraps the Terraform Cloud API steps in TFERunPlanApply with try/catch logic.After the fix, on any HTTP-level error the sub-flow: captures the error message, sets the output status to failed, returns control to the calling CPG flow with a clear error indication, and the calling flow updates the stack record to a terminal failed state.Validate in sub-prod by simulating a Terraform Cloud connectivity failure (block egress to app.terraform.io from the MID server) and confirming the stack transitions to a failed state with the error captured.For existing stacks stuck in running: update affected stack records to a terminal failed state via background script with change control; review sys_flow_context and abort orphaned sub-flow contexts.Engage Support for permanent inclusion in a future patch release if the fix is not yet GA in your target version. Related References Source Case: CS9094472 — [Cloud Governance and Provisioning] - Issue with TFERunPlanApply sub-flow error handlingPRB2011780 - https://support.servicenow.com/nav_to.do?uri=problem.do?sys_id=2ed996db93cc0f50a3ecfdb86cba10e0