The Simplest Way to Make Pulumi and Travis CI Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use pulumi and travis ci to automate cloud updates on every code push. Travis CI runs tests and triggers Pulumi to update cloud resources from code. This setup keeps cloud changes in version control. Every update goes through code review before it hits production. Engineers do not need to run cloud updates from their own laptops. How pulumi and travis ci handle logins and data flow When a developer pushes code, the code host alerts Travis CI. Travis CI starts a fresh build runner in 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 use pulumi and travis ci to automate cloud updates on every code push. Travis CI runs tests and triggers Pulumi to update cloud resources from code.

This setup keeps cloud changes in version control. Every update goes through code review before it hits production. Engineers do not need to run cloud updates from their own laptops.

How pulumi and travis ci handle logins and data flow

When a developer pushes code, the code host alerts Travis CI. Travis CI starts a fresh build runner in a clean virtual machine. The build runner pulls the latest code and installs the needed tools.

Next, the runner logs in to the Pulumi backend. It uses a token stored in the Travis CI project settings. This token lets the runner read the current state of the cloud stack.

The runner also needs keys for the target cloud provider. Teams store these cloud keys as hidden variables in Travis CI. Pulumi reads these keys to check what needs to change in the cloud.

For pull requests, Travis CI runs a preview step. Pulumi compares the new code against the current state. It sends a summary of planned changes back to the build log. When someone merges the code to the main branch, Travis CI runs the update. Pulumi makes the real calls to the cloud API and saves the new state.

Common failure modes and how to scope roles

Many teams start by using one admin key for all builds. This creates a big risk for your cloud setup. If a bad script runs in a pull request, it can read that key. The script could delete databases or steal private data.

Shared service accounts also make audit logs hard to read. When five pipelines share one key, logs show the same user for all actions. You cannot tell which build or developer broke a resource.

Travis CI Security + Pulumi Policy as Code: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Long-lived tokens cause another common problem. Teams set a token once and forget to rotate it for years. If someone leaves the team, they might still know old keys.

To fix this, split your roles by branch and job type. Give pull request builds a read-only role for cloud checks. Only give write permissions to builds that run on the main branch. Scope each Pulumi token and cloud role to one specific stack. Give the role only the exact permissions needed for the resources in that stack.

Keeping build runners and state files safe

Cloud state files often hold plain text secrets like database passwords. Pulumi encrypts secret values in the state file by default. You must still lock down who can read that state in your team.

Do not print state outputs to the public Travis CI build log. Travis CI tries to hide known secret variables in logs. Still, custom outputs from a cloud update might still slip through in plain text.

Keep your staging and production stacks in separate cloud accounts. Use different Travis CI build stages for each account. This stops a broken test build from touching live user data. You can also require a manual check before the production stage starts. Check your cloud logs often to spot odd API calls from build runners.

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

How should we run previews on pull requests?

Set Travis CI to run a preview job when a pull request opens. Use a read-only cloud role so untrusted code cannot change live resources.

Where does Pulumi store state during a Travis CI build?

Pulumi stores state in a remote backend like its cloud service or a bucket. The Travis CI runner reads and updates this remote state over the network.

How do we stop secrets from leaking in Travis CI logs?

Mark secret values in your Pulumi code so the state file encrypts them. Set secret variables as hidden in Travis CI so they do not print.

The query runs. The emails stay hidden.