Use this practical checklist to separate configuration from secrets, promote changes safely through dev, preprod, and production, and reduce failures caused by environment drift.
Overview
Application configuration and secrets often travel through the same deployment process, but they should not be handled in the same way. Configuration describes how a service should operate: feature settings, service endpoints, timeout values, log levels, and resource limits. Secrets authenticate the service or protect sensitive data: database passwords, API tokens, private keys, signing keys, and encryption material.
A reliable promotion model moves an immutable application artifact through environments while selecting environment-specific configuration at deployment time. Secret values should remain in an approved secret manager or protected CI/CD mechanism. The pipeline promotes the reference, identifier, or version of a secret—not the plaintext value itself.
| Item | Configuration | Secret |
|---|---|---|
| Examples | Log level, region, feature flag, API base URL | Database credential, OAuth secret, signing key |
| Storage | Version-controlled files, parameter stores, or deployment values | Dedicated secret manager or encrypted CI/CD store |
| Promotion | Reviewed change, often with environment overlays | Reference or approved secret version; never plaintext |
| Access | Read access can be broader, according to risk | Least-privilege access with audit logging |
| Rotation | Changed when behavior or infrastructure changes | Planned, tested, and followed by revocation of the old value |
Environment names also need a clear operational meaning. Development may prioritize fast feedback, preprod should resemble production closely enough to expose integration and release risks, and production requires the strongest access controls and change evidence. The exact topology can vary, but the differences should be documented rather than assumed.
For infrastructure values, keep environment boundaries visible in the repository and state workflow. The Terraform project structure guide provides a useful companion for separating modules, environments, state, and review workflows.
Checklist by scenario
When onboarding a service
- List every configuration value and classify it as non-sensitive configuration, sensitive configuration, or secret.
- Give each value a stable name that identifies the service, environment, and purpose.
- Document the owner, expected format, allowed scope, default behavior, and rotation responsibility.
- Create separate secret paths or namespaces for dev, preprod, and production.
- Define which workload identity, deployment role, or service account can read each secret.
- Add startup validation for required values without printing their contents to logs.
- Record whether a value may be changed at runtime or requires a restart or redeployment.
When promoting a release
- Build and identify one immutable artifact, such as a container image digest or package checksum.
- Validate configuration schema and required keys before deployment.
- Confirm that the target environment uses the intended configuration version.
- Resolve secret references through the target environment's approved secret store.
- Check that the deployment identity has only the permissions required for this service.
- Run smoke tests that exercise authentication, database connectivity, queues, and critical downstream calls.
- Record the artifact, configuration revision, secret version or reference, approver, and deployment result.
A CI/CD pipeline should fail safely when a required reference is missing, a value has the wrong type, or a production-only setting appears in a lower environment. It should not expose the value while explaining the failure. Masked logs help, but avoiding secret interpolation into shell commands and debug output is safer.
When adding or changing an environment variable
- Use a naming convention such as
PAYMENTS_PREPROD_DATABASE_URLfor inventory documentation, while keeping the actual secret path consistent with your secret manager. - Prefer names that describe purpose rather than implementation details.
- Specify type and constraints: URL, integer, duration, Boolean, list, or structured document.
- Update the service manifest, deployment template, validation schema, runbook, and example configuration together.
- Test behavior when the value is absent, malformed, expired, or intentionally disabled.
- Confirm that old variables are removed from code, manifests, dashboards, and documentation after migration.
When rotating a credential
- Identify every consumer and confirm whether it supports overlapping old and new credentials.
- Generate the replacement in the target system or secret manager without placing it in source control.
- Store it under a new version or clearly identified revision.
- Deploy the consumer with the new reference and verify real operations.
- Monitor authentication failures and dependent-service errors.
- Revoke the old credential only after the required compatibility window.
- Update the inventory and record the completion date, owner, and evidence.
What to double-check
Identity and access
Use workload identity or short-lived access where the platform supports it. Avoid sharing one powerful credential across environments. A production deployment role should not automatically read development secrets, and a developer's local identity should not be the mechanism by which a production application accesses its secret store. Review permissions for both humans and workloads, including read, write, rotate, and administer actions.
Encryption and exposure paths
Protect secrets in transit and at rest through the controls provided by the selected platform, and understand where plaintext may still appear: process arguments, crash dumps, temporary files, shell history, CI artifacts, notification messages, and verbose application logs. Redaction should be tested with representative values, including values containing punctuation or encoded characters.
Configuration drift
Compare the desired configuration with the deployed configuration on a regular basis. Useful checks include a rendered-manifest diff, a list of missing or extra keys, configuration schema validation, and a comparison of secret references by environment. Do not compare secret values in ordinary drift reports. Compare metadata such as path, version, checksum where appropriate, or rotation timestamp.
Drift commonly appears when someone changes a production parameter manually, adds a preprod-only workaround, or updates a secret store without updating the deployment definition. Treat unexplained drift as an operational event, not merely a documentation problem. For related release safeguards, see the Terraform plan review checklist and the container image security pipeline guide.
Validation and observability
Expose safe metadata in deployment records: configuration revision, environment, artifact identity, and secret reference version. Pair this with alerts for failed secret retrieval, authentication errors, repeated configuration validation failures, and unexpected restarts. Never use observability as a reason to emit secret contents. During an incident, the Kubernetes preproduction troubleshooting guide can help separate configuration failures from pod, service, or ingress problems.
Common mistakes
- Copying production secrets into preprod: This increases exposure and can cause test actions to affect production data. Use isolated accounts, data, and credentials.
- Storing secrets in the repository: Removing a value from the latest commit does not guarantee it has disappeared from history, forks, caches, or build artifacts. Revoke and replace exposed credentials.
- Using the same variable name for different meanings: A generic
URLorTOKENmakes reviews and incident diagnosis harder. Include the service and purpose. - Promoting a file containing secret values: Configuration files can be versioned safely only when sensitive values are external references or securely injected at deployment.
- Changing configuration manually without recording it: Emergency changes may be necessary, but they should produce an audit entry and a follow-up change to the declared source of truth.
- Rotating without testing consumers: Libraries, connection pools, and long-running workers may cache credentials. Verify reload and restart behavior before revoking the old value.
- Assuming masking solves exposure: Masking can fail with transformations, structured logs, or partial values. Prevent sensitive data from entering logs in the first place.
When to revisit
Review this process before seasonal planning cycles, major releases, audits, and ownership changes. Revisit it immediately when a workflow, cloud platform, secret manager, CI/CD system, deployment model, or identity design changes. A new region, cluster, service account, database, or third-party integration is also a reason to review environment boundaries and access permissions.
At least twice a year, walk through one complete promotion and one credential rotation in a non-production environment. Confirm that the documented owner still exists, access is still necessary, alerts work, rollback behavior is understood, and the old credential can be revoked safely. Keep the checklist aligned with the actual pipeline rather than preserving steps that no longer match the platform.
For the next change, start with a small inventory: list the service's configuration keys, secret references, owners, and target environments. Then run the promotion with an immutable artifact, validate the rendered configuration, verify access and health signals, and record the result. This gives the team a repeatable baseline for preventing configuration drift as the system evolves.