Skip to content

[EXPERIMENTAL] feat: stream live apply logs to audit API - #231

Open
brandonmontijo wants to merge 3 commits into
mainfrom
bmontijo/log-chunk-streaming
Open

[EXPERIMENTAL] feat: stream live apply logs to audit API#231
brandonmontijo wants to merge 3 commits into
mainfrom
bmontijo/log-chunk-streaming

Conversation

@brandonmontijo

@brandonmontijo brandonmontijo commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Buffers apply stdout line-by-line and flushes to POST /log_chunk every 10 lines or 5s
  • No-op when audit_api_url is not set — existing behavior unchanged
  • Version bump to 0.10.26

Test plan

  • Point audit_api_url at devops-testing, run tf apply, confirm chunks POST successfully
  • Confirm apply still succeeds if chunk POST fails (errors logged, not raised)
  • Unit tests added for _post_log_chunk and the on_chunk buffering/failure-handling in execute_command

Testing before merge

This feature spans 3 repos — terraform-audit-api#193 and launchpad#130 — and can't be verified in isolation:

  1. Deploy terraform-audit-api#193 to devops-testing (creates the log_chunks table + new endpoints).
  2. Install this branch locally and run a real tf apply/destroy against a devops-testing directory with audit_api_url pointed at that deploy. Confirm POST /log_chunk succeeds and local console output isn't stalling.
  3. Run launchpad#130 locally against the devops-testing API, trigger the same apply from the tfaudit UI, confirm the Output page streams live and swaps to the full output on completion.
  4. Repeat step 3 for a failing apply and for two concurrent applies in different directories.

@brandonmontijo
brandonmontijo requested a review from a team as a code owner June 30, 2026 15:09
@brandonmontijo
brandonmontijo marked this pull request as draft June 30, 2026 15:11
@brandonmontijo
brandonmontijo marked this pull request as ready for review July 6, 2026 21:35
- Bump version to 0.11.5 (was based on stale 0.11.4/0.10.26)
- _chunk_callback now posts to every URL in audit_api_url, matching
  the multi-URL support added to _post_audit_info on main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants