The Simplest Way to Make Dynatrace and Pulumi Work Like They Should
Teams use dynatrace and pulumi to manage cloud apps and alert rules as code. Pulumi builds cloud stacks and sets up Dynatrace dashboards in one run. This workflow keeps your app rules and monitoring checks in sync across all stacks. When a team ships a new service, Pulumi creates the needed alert rules right away. Nobody has to click through web menus to set up basic health checks. How dynatrace and pulumi share keys and data Pulumi talks to the Dynatrace API during every preview and update
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 dynatrace and pulumi to manage cloud apps and alert rules as code. Pulumi builds cloud stacks and sets up Dynatrace dashboards in one run.
This workflow keeps your app rules and monitoring checks in sync across all stacks. When a team ships a new service, Pulumi creates the needed alert rules right away. Nobody has to click through web menus to set up basic health checks.
How dynatrace and pulumi share keys and data
Pulumi talks to the Dynatrace API during every preview and update run. To do this, the Pulumi runner needs a valid API token or client key. The runner reads your code and sends requests to the monitoring API.
Dynatrace checks the token permissions before it allows any read or write action. If the key has the right scope, the API updates the alert rules. Then it sends back the new resource IDs so Pulumi can save them.
Pulumi stores these resource IDs and settings inside its own state file. During the next run, Pulumi compares your code against the saved state file. It also checks the live monitoring setup to spot any manual changes.
Data flows both ways during a deployment run between the two tools. Cloud resource names and tags move from Pulumi into your monitoring rules. Metric IDs and dashboard links can also flow back into your stack outputs.
Common security gaps and how to scope roles
Many teams start by sharing one master API key across all build jobs. That single token often holds full admin rights over every monitoring setting. If that key leaks, an attacker can delete alerts or read sensitive logs.
Shared service accounts also make it hard to track who changed a rule. Looking at the audit log only shows the shared bot account name. You cannot tell which engineer or build job ran the update.
Broad tokens create risk when junior devs run local previews on their laptops. A local check only needs read rights, not full write permissions. Giving full keys to local machines leaves your production setup open to mistakes.
Pulumi Policy as Code + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
State files bring another risk because they can hold plain text values. If a rule includes a webhook secret, that secret lands in the state file. Anyone who can read the state backend might see those private values.
You can fix these issues by splitting tokens by job type and stack. Create one read-only key for local previews and pull request checks. Create separate write keys for your main deployment jobs in each stack.
Scope each token so it only touches the exact rules that stack manages. Do not grant account-wide admin permissions to a single app deployment pipeline. Limit network paths so only trusted build runners can reach the management API.
Managing state and drift across team stacks
Large teams often split their cloud stacks by service or by stage. You should split your monitoring code in the exact same way. Keep core alert rules in a base stack owned by the platform team.
Let app teams manage their own service dashboards in smaller, separate stacks. This split keeps state files small and makes every deployment run much faster. It also stops one broken dashboard from blocking a critical app fix.
Sometimes an engineer will change an alert threshold inside the web UI during an outage. The next Pulumi run will see this drift and try to revert it. Teams should check preview logs often and copy good manual fixes into code.
Always mark sensitive inputs as secrets inside your Pulumi code before you run updates. This step encrypts the values before they ever reach the state storage backend. Rotate your API keys on a set schedule to limit exposure over time.
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 store Dynatrace API tokens for Pulumi runs?
Store your API tokens in an encrypted secret manager or Pulumi secret store. Never put raw tokens into plain text config files or source code repos. Inject the token into the build runner only when the job starts.
What permissions does Pulumi need to manage Dynatrace settings?
Grant only the specific read and write scopes required for the resources in code. Use a read-only token for pull request previews and drift checks. Save write permissions for the automated runner that merges changes to main.
How do we handle manual changes made in the Dynatrace UI?
Run a refresh check in Pulumi to compare live settings with your state file. Review the diff to see if the manual UI change should stay. Update your code to match the live rule or let Pulumi overwrite it.
Related guides
In this post