Secrets should follow the same process when managing infrastructure with GitOps while maintaining security. Terrateam and Doppler create a powerful combination that lets you define how secrets are used in your infrastructure without committing sensitive values to Git. Doppler stores and manages the actual secrets and makes sure they're available wherever needed. If a secret gets rotated or you roll something back, Doppler can help keep everything in sync.
GitOps treats secrets as part of your infrastructure-as-code workflow, with your codebase as the single source of truth for how secrets are used, while keeping sensitive values out of the repository. Every change is tracked, reviewed, and applied through pull requests. By using Doppler for secure secret storage and Terrateam for automation, you get the best of both worlds:
This approach works well for secure automation scenarios where code defines everything. With GitOps, changes are visible, reversible, and secure. Doppler ensures that rotating or rolling back secrets does not break dependent services, and developers and DevOps teams can manage secrets alongside infrastructure.
Terrateam automates Terraform workflows using GitOps through GitHub pull requests. When you open a PR, it runs a terraform plan and posts the output for review. Once the PR is approved and merged, it runs terraform apply, making sure changes are reviewed before being applied consistently across environments.
Doppler is a SecretOps platform that provides secure storage, management, and distribution of secrets across your infrastructure. It integrates with Terraform to let you reference secrets without exposing their values in your code.
Let’s explore three common approaches to managing secrets with Doppler and Terraform in a GitOps workflow:
We’ll start with the basic setup and then explore each approach.
This configuration enables automatic terraform apply on merge, disables cost estimation, and uses OIDC for secure AWS access. The S3 backend keeps Terraform state encrypted and centralized.
There are two ways to authenticate with Doppler in Terraform:
This allows Terraform to access Doppler securely, keeping the token out of your codebase. Make sure it is injected into the Terraform runtime environment as an environment variable.
Configure your GitHub workflow to inject this token into the Terraform environment.
A service account is preferred as it isn’t tied to a specific user account, has scoped permissions following the principle of least privilege, and can be easily rotated without affecting user access.
Now, let’s explore the three typical approaches to integrating Doppler with Terraform. For each approach, create a feature branch and add a main.tf file to define your infrastructure configuration.
This approach is ideal when you have pre-existing secrets in Doppler that you want to use in your infrastructure.
This approach is practical when you need to generate new credentials (like database passwords) during infrastructure provisioning.
This approach is practical when you want to manage the structure of your Doppler projects in Terraform, but not the actual secret values.
After defining your Terraform configuration, push your branch and open a PR. Terrateam detects Terraform changes, automatically run terraform plan and posts the output to the PR as a comment.
Review the plan to confirm resources and secrets are configured correctly. Merge the PR to trigger terraform apply.
Terrateam and Doppler provide a straightforward way to manage secrets in a GitOps workflow without adding extra complexity.
By keeping secrets out of Git and using Doppler to store and update them, teams avoid accidental exposure while still benefiting from version control and automation, which enhances security.
Terrateam handles the execution of Terraform plans and applies them through pull requests, so every change is reviewed, improving visibility and consistency.
This approach is reliable, auditable, and easily integrated into existing infrastructure workflows.
Teams managing microservices can reference existing Doppler secrets in their Terraform code without exposing sensitive values. When provisioning a new service via a Terrateam PR, the plan shows which resources will be created and what secrets will be used, without revealing the actual values. For example, a new analytics service can fetch database credentials from Doppler at runtime, and if those credentials change later, no code updates are needed.
To stay with the database case, when creating database instances, teams can use Terraform to generate credentials securely, provision resources with these credentials, and automatically store connection details in Doppler.
Application developers never manually handle these secrets; they simply configure their services to fetch them from Doppler. For credential rotation, a simple Terraform apply through a Terrateam PR updates the infrastructure and Doppler simultaneously, with all dependent services automatically receiving the new values.
Organizations can also maintain a consistent secret structure while allowing different teams to manage the actual values by using Terraform with dummy values and lifecycle ignore rules, which establishes a “contract” for required secrets without dictating their values.
When it’s time to deploy a new service, developers can use this template to create a Doppler project and populate the value through the UI. This approach comes in handy when a strict separation of duties or strict compliance requirements are needed.
Implementing GitOps for secrets with Terrateam and Doppler provides a secure, consistent, and automated approach to managing sensitive information in your infrastructure. By keeping secrets outside Git while treating their usage as code, you benefit from GitOps without compromising security.
Whether retrieving existing secrets, generating new ones, or managing projects, start by choosing the approach that fits your use case. As your needs evolve, you can combine these approaches to create a comprehensive secret management strategy for your organization.
Like infrastructure, GitOps for secrets means managing secrets through pull requests and code reviews. Secrets are treated as code inputs, not committed values. With tools like Terrateam and Doppler, you define secrets in Terraform and inject them securely during runtime.
Trusted by the world’s best DevOps and security teams. Doppler is the secrets manager developers love.