The Simplest Way to Make Bitbucket and Pulumi Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair bitbucket and pulumi to update cloud resources from source code changes. When a developer opens a pull request, the pipeline previews or runs the stack update. This workflow turns manual cloud clicks into tracked code reviews. Every change goes through git history before it touches live cloud accounts. Teams can see what will change before they merge any branch. How bitbucket and pulumi handle logins and data flow The pipeline starts when a developer pushes code to a git branch. A

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.

Teams pair bitbucket and pulumi to update cloud resources from source code changes. When a developer opens a pull request, the pipeline previews or runs the stack update.

This workflow turns manual cloud clicks into tracked code reviews. Every change goes through git history before it touches live cloud accounts. Teams can see what will change before they merge any branch.

How bitbucket and pulumi handle logins and data flow

The pipeline starts when a developer pushes code to a git branch. A runner picks up the job and checks out the repo files. Next, the runner must log in to both the state backend and the cloud provider.

For the state backend, the runner uses an API token or federated identity. Federated identity lets the runner trade a short job token for cloud permissions. This avoids storing static cloud keys inside repo settings.

Once logged in, the tool reads the current state file from the backend. It compares the code in the git branch against the live cloud setup. During a pull request, it writes a preview summary back to the code review page. When a reviewer merges the branch, the main pipeline runs the actual update.

Common failure modes and how to scope roles

Many teams start by putting one broad admin key in workspace variables. Any branch or runner in that workspace can read and use that key. If a bad script runs in a test branch, it can wipe out production databases.

Shared service accounts also make audit logs hard to read. When five pipelines share one user key, cloud logs show the same actor for every change. You cannot tell which repo or branch broke a live service.

Pulumi Policy as Code + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged state reads create another risk for growing teams. State files often hold raw database secrets, phone numbers, or emails from app settings. If any developer can run local updates with a shared token, sensitive values spill onto laptops.

To fix this, split your pipelines into two separate roles. Give pull request runners a read-only role that can only run previews. Give the main branch runner a write role scoped only to the resources it manages. Lock production variables to protected branches so feature branches cannot read them.

Managing state locks and concurrent pipeline runs

Fast teams often merge two pull requests within a few minutes. If two runners try to update the same stack at once, state files can break. One job might overwrite changes made by the other job.

You can stop this by turning on concurrency limits in your pipeline setup. Tell the runner to pause new jobs on the main branch until the active job finishes. The state backend also uses a lock file during updates to block parallel writes.

If a runner crashes mid-run, the state lock might stay stuck. Teams need a clear, logged process to check the cloud state and clear stale locks. Never let automated scripts force-manage state on every run, or you will lose concurrency safety.

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

How should we store cloud secrets for pipeline runs?

Use federated identity between your git runner and your cloud provider whenever possible. This setup gives each pipeline run a temporary role instead of a long-lived secret key.

How do we stop feature branches from changing production stacks?

Use deployment protections in your repo settings to lock production credentials to the main branch. Set pull request pipelines to run preview commands with read-only cloud roles.

What happens when a pipeline fails halfway through a stack update?

The state backend records the resources that finished before the error happened. You can fix the code or cloud issue and run the pipeline again to finish the update.

The query runs. The emails stay hidden.