Skip to content

feat: add HCP run-id input source#633

Open
dwizzle204 wants to merge 1 commit intooocx:mainfrom
dwizzle204:feat/hcp-input
Open

feat: add HCP run-id input source#633
dwizzle204 wants to merge 1 commit intooocx:mainfrom
dwizzle204:feat/hcp-input

Conversation

@dwizzle204
Copy link

Summary

  • Add native HCP Terraform run-id input via --hcp-run-id <id> so tfplan2md can fetch plan JSON directly from HCP/TFE.
  • Keep the existing parse/render pipeline unchanged by introducing this strictly as a new input source.
  • Add focused docs and tests for authentication, endpoint validation, conflict handling, and API error paths.

What Changed

  • CLI / wiring

    • Added --hcp-run-id parsing and input-mode conflict validation.
    • Routed HCP mode through ProgramEntry input selection logic.
  • New HCP input adapter

    • Added HcpTerraformPlanInput to:
      • require TFE_TOKEN
      • optionally use TFE_ADDRESS (default https://app.terraform.io)
      • resolve run -> plan relationship
      • fetch plan JSON output
      • return actionable errors for auth/HTTP/payload failures
  • Tests

    • Added mocked HTTP tests for:
      • successful run-id flow
      • missing token
      • non-success HTTP responses
      • malformed/unexpected payloads
      • HTTPS validation for TFE_ADDRESS
  • Docs / examples

    • Updated CLI/help docs for HCP mode and env vars.
    • Added example usage: examples/hcp-run-id/README.md.

Notes

  • This PR intentionally does not change markdown rendering behavior.
  • Branch history was squashed to a single commit for clean review.

Closes #632

@oocx
Copy link
Owner

oocx commented Mar 21, 2026

Thank you for your contribution! I am currently on vacation and will be unable to do proper reviews before I am back home in about a week.

@dwizzle204
Copy link
Author

Thank you for your contribution! I am currently on vacation and will be unable to do proper reviews before I am back home in about a week.

No worries enjoy your time off!

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.

Add native HCP Terraform run-id input support (--hcp-run-id) in tfplan2md

2 participants