Skip to content

feat: adds pre hook steps to config and tree builder#561

Open
anuragrao04 wants to merge 1 commit intoterrateamio:mainfrom
anuragrao04:feat/config-builder-gh-token
Open

feat: adds pre hook steps to config and tree builder#561
anuragrao04 wants to merge 1 commit intoterrateamio:mainfrom
anuragrao04:feat/config-builder-gh-token

Conversation

@anuragrao04
Copy link
Copy Markdown

This PR runs pre-hook steps in the config builder and tree builder, matching the pattern already used by plan and apply. On GitHub Actions this executes update_terrateam_github_token to populate TERRATEAM_GITHUB_TOKEN with a fresh app token before the builder script runs. On GitLab CI it's a no-op.

Previously, the builders called their scripts directly via cmd.run_with_output() without running any hooks, so the token step never executed and the builders only had access to the repo-scoped GitHub Actions token. This wires them into the same runtime.update_pre_hook_steps() + hooks.run_pre_hooks() path so they get the Terrateam app token like plan and apply do.

@anuragrao04 anuragrao04 requested a review from a team as a code owner March 4, 2026 11:11
@orbitz
Copy link
Copy Markdown
Contributor

orbitz commented Mar 6, 2026

This is a change in semantics and I'm hesitant to merge it without some more deep thought. I know you're making use of what's available here, but I need to think through a bit what the right thing to do is. Is it really that you want access to the github token?

@anuragrao04
Copy link
Copy Markdown
Author

Yep, this feature add is to just give access to TERRATEAM_GITHUB_TOKEN in config builder and tree builder.

Tree builder often pulls terraform modules from other repos (a module repo) while doing the generation. In my use case, it runs terragrunt stack generate.

The config builder also runs terragrunt stack generate to register generated dirs since the generated files are not carried over from tree builder to config builder.

@anuragrao04
Copy link
Copy Markdown
Author

Here are two threads from the terrateam slack for extra context:

  1. Discussing this issue and talking about a PR
  2. Discussing about tree builder and file carry-over

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