terrateam: plan from drift issues Terrateam, a GitHub-native infrastructure-as-code platform, now supports running `terrateam plan` from drift issues via a GitHub Actions relay that creates a temporary draft PR, enabling plan execution without pull request approval. The relay, developed by Perrotta, preserves Terrateam's locks, hooks, and credentials, and a live test returned 'Plan: 0 to add, 8 to change, 0 to destroy'. Apply remains unsupported because issues lack PR approval intent. ♠ Problem statement : Terrateam opens drift reports as GitHub issues, but terrateam plan only works on pull requests. The distinction is explicit in Terrateam’s issue comment handler https://github.com/terrateamio/terrateam/blob/cc723447ff80023b8627df6f8719bfb38462cf87/code/src/terrat vcs service github/terrat vcs service github ep events3.ml L550-L655 : { primary = Primary.{ number = pull request id; pull request = Some ; }; }; | Gw.Issue comment event.Issue comment created - Logs.debug fun m - m "%s : NOOP : ISSUE COMMENT CREATED" request id ; Prmths.Counter.inc one Metrics.comment events total "noop" ; Abbs future combinators.return ok Calling the repository workflow directly was not an option either. Its work token comes from the Terrateam backend. So I kept Terrateam in charge and gave it the pull request it expects. A GitHub Actions relay checks that the source is an open Terrateam drift issue and that the commenter has repository write access. It then puts a comment-only Terraform file in each selected drift directory: markers = InputGitTreeElement path=f"{directory}/terrateam issue relay.tf", mode="100644", type="blob", content=f" Terrateam plan relay for drift issue {issue number}, comment {comment id}.\n", for directory in directories That path change gives Terrateam a real dirspace without changing infrastructure. The relay opens a temporary draft PR and posts the original command on it: pull = repo.create pull base=repo.default branch, head=branch, title=f"Terrateam plan relay for drift issue {issue number}", body=relay body issue number, comment id, event "comment" "html url" , draft=True, pull.as issue .create comment command Terrateam uses its normal locks, hooks, credentials, and batching. Another workflow copies its comments back to the drift issue. apply remains unsupported: an issue has no PR approval or review intent. The live test planned the requested directory and returned the result: Plans :thumbsup: Terrateam Plan Output :thumbsup: Plan: 0 to add, 8 to change, 0 to destroy The temporary PR ended where it should: % gh pr view 6687 --json number,state,headRefName,title {"headRefName":"bot/terrateam-issue-relay/6663-5398113346","number":6687,"state":"CLOSED","title":"Terrateam plan relay for drift issue 6663"} % ./ci/run python tests.sh ci/terrateam issue relay collected 19 items tests/test relay.py ................... 100% ============================== 19 passed in 1.45s ============================== A scheduled job deletes inactive relay branches after 30 hours. Terrateam still owns plan execution; the relay only translates the issue command into its existing PR protocol. 🤖 Drafted with ∎ /bloggify .— § — Reply via email mailto:serendipity@perrotta.dev?subject=Reply to: terrateam: plan from drift issues