Prompt
I’m building dev/test/prod environments and want one declarative setup
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
A good way to do this is to make your environment setup parameterized and declarative, so you define the stack once and supply only environment-specific values.
Recommended pattern
1) Define a single base configuration
Use one source of truth for:
- compute resources
- network layout
- databases
- queues/topics
- IAM/permissions
- app configuration structure
Then override only values like:
- instance sizes
- replica counts
- domain names
- feature flags
- secrets references
- logging levels
2) Use environment overlays
Typical structure:
infra/
base/
app.yaml
db.yaml
network.yaml
overlays/
dev.yaml
test.yaml
prod.yaml
Or, if you use Terraform:
terraform/
modules/
app/
db/
network/
envs/
dev/
main.tf
terraform.tfvars
test/
main.tf
terraform.tfvars
prod/
main.tf
terraform.tfvars
3) Keep environment differences explicit
Avoid branching logic everywhere. Instead, centralize variables like:
environment = "dev"
instance_type = "t3.micro"
replicas = 1
enable_autoscaling = false
log_level = "debug"
and for prod:
environment = "prod"
instance_type = "m7g.large"
replicas = 3
enable_autoscaling = true
log_level = "info"
Best tools for this
If you’re using Kubernetes
- Helm for templating
- Kustomize for overlays
- GitOps tools like Argo CD or Flux
If you’re using cloud infrastructure
- Terraform with reusable modules
- Terragrunt if you want easier env composition
- Pulumi if you prefer general-purpose languages
If you want app + infra in one declarative layer
- Docker Compose for local/dev
- Then pair with Terraform/Helm for cloud deploys
Good practices
- Make dev/test/prod use the same architecture
- Change only scale, security, and external endpoints
- Store secrets separately from config
- Use CI/CD to validate and promote the same artifact
- Add policy checks so prod settings can’t drift from standards
A simple rule of thumb
- One module/chart/spec
- Three environment value files
- Same deployment pipeline
- Different parameters, not different code
If you want, I can show you a concrete example in Terraform, Kubernetes Helm, or Docker Compose + env files.