The Simplest Way to Make Compass and Terraform Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use compass and terraform to track software services through code. Terraform builds the cloud resources and writes service details into the Compass catalog. Manual catalog updates fail as a team grows. People forget to update owner names, links, and service tiers after a deploy. Defining catalog entries in code keeps your service map fresh and accurate. Every code change updates both your cloud setup and your service catalog. How compass and terraform share data and permissions Terrafo

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 compass and terraform to track software services through code. Terraform builds the cloud resources and writes service details into the Compass catalog.

Manual catalog updates fail as a team grows. People forget to update owner names, links, and service tiers after a deploy. Defining catalog entries in code keeps your service map fresh and accurate. Every code change updates both your cloud setup and your service catalog.

How compass and terraform share data and permissions

Terraform talks to the Compass API during a plan or apply run. The provider reads your code files and sends requests to your catalog workspace. You can create components, links, and team ownership rules in one run.

To make this work, the build runner needs an API token. That token proves who is making the change and what they can edit. The runner logs in with this token and reads the current catalog state. Next, it compares that state to your local code files. Then it sends write requests to add or change catalog entries.

Data flows in both directions during a normal run. Terraform reads existing component IDs from the catalog first. Then it writes new resource links and tags back to those components. Storing state in a remote backend stops teams from overwriting each other's catalog data.

Common failure modes and how to scope roles

Many teams use one shared admin key for all their catalog updates. If that key leaks, an attacker can delete your whole service catalog. Shared keys also make audit logs hard to read. When a bad change happens, you cannot see which repo made the call.

Broad permissions cause problems during normal work too. A mistake in one service repo should not wipe out another team's catalog page. Give each build pipeline its own scoped service account instead. Restrict that account so it only edits components owned by that specific team.

Terraform Security (tfsec, Checkov) + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged changes create another big blind spot for platform teams. People often run code tools from their laptops using personal admin keys. These local runs bypass code review and leave no clear trail in your build logs. Block direct catalog writes from developer laptops by limiting who holds write keys.

Keeping state files and catalog data in sync

Drift happens when people edit catalog entries in the web UI by hand. The next time the code pipeline runs, it will overwrite those manual edits. Pick one source of truth for each field in your catalog. Let code manage core fields like repo links, tiers, and team owners.

Keep your state files safe and locked during every run. State files hold catalog IDs and sometimes sensitive variables from your cloud setup. Encrypt the state storage bucket and limit who can read those files. Only the build runner and core platform admins should hold read roles.

Rotate your API keys on a set schedule to reduce risk. Old keys sitting in build settings are a common target for attackers. When you keep permissions tight and keys fresh, your catalog stays clean and safe.

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

What happens if someone edits a catalog entry in the UI?

The next code run will overwrite manual changes to fields managed by code. Tell your team to make updates in the code repo instead of the UI.

Should we use one state file for the whole service catalog?

No, one large state file slows down runs and raises risk. Split your catalog code by team or service so each repo manages its own components.

How do we handle API keys for local testing?

Give developers read-only tokens so they can test plans without making live changes. Only the automated build pipeline should hold a key that can write data.

The query runs. The emails stay hidden.