The Simplest Way to Make GitHub Actions and Pulumi Work Like They Should
You pair github actions and pulumi to build cloud stacks straight from your code repo. This setup runs previews on pull requests and ships changes when your team merges code. Teams use this workflow to keep cloud state in sync with git branches. Every code push triggers a runner that checks your stack and posts a clear diff. How github actions and pulumi share keys and data A workflow job starts on a runner when a developer opens a pull request. The runner needs two sets of keys to do its jo
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You pair github actions and pulumi to build cloud stacks straight from your code repo. This setup runs previews on pull requests and ships changes when your team merges code.
Teams use this workflow to keep cloud state in sync with git branches. Every code push triggers a runner that checks your stack and posts a clear diff.
How github actions and pulumi share keys and data
A workflow job starts on a runner when a developer opens a pull request. The runner needs two sets of keys to do its job well.
First, the runner logs in to the state backend to read the current stack. Second, it logs in to your cloud account to check or change real resources.
Old setups store static keys in repo secrets and pass them to the runner. A better way uses OpenID Connect tokens to trade job identity for short-lived cloud roles.
Once logged in, the engine compares your code against the saved state file. It sends the planned changes back to the pull request as a comment for review.
When a reviewer approves and merges the branch, a new job runs the update. The engine writes the new state back to the backend and closes the loop.
Common failure modes and how to scope roles
Many teams give their runners one shared admin account for all cloud tasks. If a bad script runs in a pull request, it can take that broad token.
Another big risk happens when pull requests from forks trigger write jobs by mistake. A user can edit the code to print secret keys into the build logs.
Unlogged database queries or ad-hoc scripts inside build steps also create blind spots. Security teams cannot tell which user ran a command when everyone shares one machine key.
GitHub Actions Security + Pulumi Policy as Code: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
You can fix this by splitting your workflows into two distinct roles. Give pull request jobs a read-only role that can only run previews.
Reserve the write role for jobs that run on your protected main branch. Lock down the trust rule so only your main branch can claim the write role.
You should also place runners inside a private network when they touch internal systems. This prevents you from opening your database ports to the public internet during a deploy.
Managing state locks and concurrent runs
Fast teams merge code often, which can start two deploy jobs at the same time. If two jobs try to update the same stack at once, the second job fails.
Your state backend uses a lock file to stop two runners from writing together. This protects your cloud resources from getting torn apart by racing updates.
You should set up concurrency rules in your workflow so jobs wait in line. When a new merge happens, the runner waits for the active deploy to finish first.
For preview jobs on pull requests, you can cancel older runs when new commits arrive. This saves runner minutes and gives the developer fast feedback on their latest code.
If a runner crashes mid-run, the state lock might stay stuck in the backend. Keep a clear process so an admin can verify the crash and clear the lock.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Should pull requests run previews with write keys?
No, pull requests should only use read-only cloud roles. This stops untrusted code from changing live stacks before a human reviews the diff.
How do we stop long-lived tokens in repo secrets?
Use OpenID Connect between your git host, your state backend, and your cloud provider. The runner gets a short token that expires as soon as the job ends.
What happens when two merges trigger stack updates at once?
The state backend locks the stack for the first job and blocks the second one. Use workflow queue settings so the second job waits its turn instead of failing.
Related guides
In this post