The Simplest Way to Make Dataproc and Pulumi Work Like They Should
Using dataproc and pulumi lets teams build and tear down Spark clusters with code. You write cluster rules in code, and the tool creates the cloud resources. Data teams run big batch jobs on these clusters every day. Keeping clusters up all day wastes money when no jobs run. Writing code to start and stop them saves cash and cuts manual work. It also keeps test and live setups identical across the whole team. How permissions and data flow in dataproc and pulumi The code tool needs a cloud ro
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.
Using dataproc and pulumi lets teams build and tear down Spark clusters with code. You write cluster rules in code, and the tool creates the cloud resources.
Data teams run big batch jobs on these clusters every day. Keeping clusters up all day wastes money when no jobs run. Writing code to start and stop them saves cash and cuts manual work. It also keeps test and live setups identical across the whole team.
How permissions and data flow in dataproc and pulumi
The code tool needs a cloud role to talk to the Google API. You log in with a deployment service account before you run an update. That service account sends requests to create disks, networks, and cluster nodes.
Once the cluster starts, it uses a second cloud role for its own work. This worker role reads input files from cloud buckets and writes output back. Keeping the deploy role separate from the worker role limits risk. The code tool also saves state data about every cluster it builds. You store this state file in a locked bucket or a managed backend. When a developer changes node counts, the tool checks the state file first. Then it sends an API call to resize the cluster right away.
Fixing common permission and network mistakes
Many teams give the deployment role full admin rights to save time. Others let the cluster worker role use the default compute service account. That default account often has broad project rights that jobs do not need. If a bad script runs on a node, it can read private buckets. You fix this by making two small custom roles in your code.
First, give the deploy account only the rights to build clusters and networks. Second, give the worker account read and write rules for specific buckets only. Shared keys and long-lived tokens also cause trouble during team audits. When everyone uses one static key, cloud logs cannot show who changed a cluster. Use workload identity federation so your build pipeline gets short-lived tokens instead.
Pulumi Policy as Code + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Network paths between the runner and the cloud API need tight rules too. Put cluster nodes on private subnets without public IP addresses. Turn on private Google access so nodes reach cloud storage over internal paths. If sensitive columns like emails or card numbers sit in job data, protect them. Masking rewrites matched fields in results when engineers inspect tables or job logs. This setup stops data leaks and keeps every cluster change tied to a commit.
Managing cluster lifecycles for batch workloads
Long-running clusters often drift when engineers log in and install packages by hand. Soon, no one knows which library versions a job needs to pass. Defining ephemeral clusters in your deployment code solves this problem for good. Your pipeline spins up a fresh cluster right before a big job starts.
Init scripts in your code install the exact packages the job needs. When the job ends, the pipeline tears the whole cluster down. You pay only for the minutes the nodes actually process data. Every run starts clean, and no old files or broken settings linger.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Should I manage jobs and clusters in the same stack?
Keep long-lived network and storage resources in a base stack. Put short-lived clusters and batch jobs in a separate stack so updates run fast.
How do I handle secrets for Spark jobs in code?
Store secrets in a secret manager or encrypted state store. Grant the cluster worker role permission to read only the specific secret it needs.
Why does cluster deletion fail during a stack destroy?
Deletion often fails when active jobs still hold locks on cluster nodes. Drain or cancel running jobs first, then run the destroy command again.
Related guides
In this post