GistPin manages environment-specific configuration across three environments: development, staging, and production. This document outlines the configuration strategy, validation process, and best practices.
| Source | Format | Purpose |
|---|---|---|
.env.* files |
KEY=VALUE |
Application-level environment variables |
Terraform .tfvars |
HCL | Infrastructure variable overrides per environment |
| Kubernetes ConfigMaps | YAML | Runtime configuration injected into pods |
The configuration validation pipeline (infrastructure/ci/config-validation.yml) runs on every PR and push that modifies configuration files. It performs:
- Terraform variable consistency - Ensures all required variables exist across environment
.tfvarsfiles - ConfigMap key parity - Detects missing or extra keys between environment ConfigMaps
- Env file completeness - Validates all variables defined in
.env.*.exampleexist in the corresponding.env.*file
- Add the variable to all environment files (dev, staging, production)
- Update the corresponding
.env.*.examplefile - If it's a Terraform variable, add it to
infrastructure/terraform/variables.tf - If it's a Kubernetes ConfigMap key, add it to all environment ConfigMaps
Critical configuration inconsistencies block deployments on the main branch. The pipeline exits with a non-zero code when:
- A required variable is missing in any environment
- A ConfigMap key exists in one environment but not another
- Terraform variable files are malformed or missing
- Never commit secrets to
.env.*files; use Kubernetes Secrets or AWS Secrets Manager - Keep
.env.*.examplefiles in sync with actual environment files - Use Terraform workspaces or Terragrunt for environment-specific infrastructure
- Review config diffs carefully during code review