Managing Environment Configurations
Overview
Manage application configurations across development, staging, and production environments using .env files, Kubernetes ConfigMaps/Secrets, SSM Parameter Store, and cloud-native configuration services. Enforce consistency, prevent configuration drift, and implement safe promotion workflows between environments.
Prerequisites
- Access to all target environments (dev, staging, production)
- Configuration management tool or pattern identified (dotenv, ConfigMaps, SSM, Consul)
- Version control for configuration files (separate repo or encrypted in application repo)
- Encryption tool for sensitive values (
sops, age, sealed-secrets, or cloud KMS)
- Understanding of which values differ between environments vs. which are shared
Instructions
- Audit existing configuration: scan for
.env files, config/ directories, Kubernetes ConfigMaps, and hardcoded values in source code
- Classify each configuration value: public (non-sensitive, varies per env), secret (credentials, API keys), and static (same across all envs)
- Extract hardcoded values into externalized configuration with a clear naming convention (
APP_DATABASE_HOST, APP_REDIS_URL)
- Create environment-specific configuration files:
.env.development, .env.staging, .env.production
- Encrypt sensitive values using
sops with cloud KMS or sealed-secrets for Kubernetes
- Generate Kubernetes ConfigMaps and Secrets from environment files for cluster-based deployments
- Set up configuration validation: schema checks to ensure all required variables are present before deployment
- Implement promotion workflow: changes go to dev first, then promote to staging after testing, then to production with approval
- Add configuration drift detection: compare running environment against source-of-truth on a schedule
Output
- Environment-specific configuration files (
.env.*, config/*.yaml)
- Kubernetes ConfigMap and Secret manifests per environment
- Configuration schema/validation script to catch missing variables
- SOPS-encrypted secret files with
.sops.yaml rules
- CI/CD pipeline steps for configuration validation and deployment
Error Handling
| Error |
Cause |
Solution |
Missing required environment variable |
Variable defined in schema but absent from .env file |
Add the variable to the environment file; run validation script before deploy |
SOPS decryption failed |
Wrong KMS key or expired credentials |
Verify KMS key ARN in .sops.yaml; refresh cloud credentials |
ConfigMap too large |
Kubernetes 1MB ConfigMap size limit exceeded |
Split into multiple ConfigMaps or mount as files from a volume |
Configuration drift detected |
Manual changes made directly to running environment |
Re-apply configuration from source-of-truth; block direct environment edits |
Secret exposed in logs |
Application logging sensitive config values at startup |
Mask secrets in logging output; audit code for accidental secret printing |
Examples
- "Create an environment configuration system using
.env files for a Node.js app with SOPS encryption for secrets and validation that all required vars are set."
- "Generate Kubernetes ConfigMaps and Secrets from environment files for dev, staging, and production namespaces."
- "Set up a configuration promotion workflow: edit in dev, validate in CI, promote to staging via PR, deploy to production with approval gate."
Resources
Source: jeremylongshore/claude-code-plugins-plus-skills → skills/.curated/managing-environment-configurations/SKILL.md
Also appears in: jeremylongshore/claude-code-plugins-plus-skills/plugins/devops/environment-config-manager/skills/managing-environment-configurations/SKILL.md
1---
2name: managing-environment-configurations
3description: "'Implement environment and configuration management with comprehensive guidance and automation. Use when you need to work with environment configuration. Trigger with phrases like \"manage environments\", \"configure environments\", or \"sync configurations\". '"
4allowed-tools: "Read, Write, Edit, Grep, Glob, Bash(cmd:*)"
5category: general-purpose
6source_repo: jeremylongshore/claude-code-plugins-plus-skills
7source_path: "skills/.curated/managing-environment-configurations/SKILL.md"
8source_url: https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/HEAD/skills/.curated/managing-environment-configurations/SKILL.md
9metadata:
10 source: https://skillmd.com/skills/thedixitjain/managing-environment-configurations
11---
12
13# Managing Environment Configurations
14
15## Overview
16
17Manage application configurations across development, staging, and production environments using `.env` files, Kubernetes ConfigMaps/Secrets, SSM Parameter Store, and cloud-native configuration services. Enforce consistency, prevent configuration drift, and implement safe promotion workflows between environments.
18
19## Prerequisites
20
21- Access to all target environments (dev, staging, production)
22- Configuration management tool or pattern identified (dotenv, ConfigMaps, SSM, Consul)
23- Version control for configuration files (separate repo or encrypted in application repo)
24- Encryption tool for sensitive values (`sops`, `age`, `sealed-secrets`, or cloud KMS)
25- Understanding of which values differ between environments vs. which are shared
26
27## Instructions
28
291. Audit existing configuration: scan for `.env` files, `config/` directories, Kubernetes ConfigMaps, and hardcoded values in source code
302. Classify each configuration value: public (non-sensitive, varies per env), secret (credentials, API keys), and static (same across all envs)
313. Extract hardcoded values into externalized configuration with a clear naming convention (`APP_DATABASE_HOST`, `APP_REDIS_URL`)
324. Create environment-specific configuration files: `.env.development`, `.env.staging`, `.env.production`
335. Encrypt sensitive values using `sops` with cloud KMS or `sealed-secrets` for Kubernetes
346. Generate Kubernetes ConfigMaps and Secrets from environment files for cluster-based deployments
357. Set up configuration validation: schema checks to ensure all required variables are present before deployment
368. Implement promotion workflow: changes go to dev first, then promote to staging after testing, then to production with approval
379. Add configuration drift detection: compare running environment against source-of-truth on a schedule
38
39## Output
40
41- Environment-specific configuration files (`.env.*`, `config/*.yaml`)
42- Kubernetes ConfigMap and Secret manifests per environment
43- Configuration schema/validation script to catch missing variables
44- SOPS-encrypted secret files with `.sops.yaml` rules
45- CI/CD pipeline steps for configuration validation and deployment
46
47## Error Handling
48
49| Error | Cause | Solution |
50|-------|-------|---------|
51| `Missing required environment variable` | Variable defined in schema but absent from `.env` file | Add the variable to the environment file; run validation script before deploy |
52| `SOPS decryption failed` | Wrong KMS key or expired credentials | Verify KMS key ARN in `.sops.yaml`; refresh cloud credentials |
53| `ConfigMap too large` | Kubernetes 1MB ConfigMap size limit exceeded | Split into multiple ConfigMaps or mount as files from a volume |
54| `Configuration drift detected` | Manual changes made directly to running environment | Re-apply configuration from source-of-truth; block direct environment edits |
55| `Secret exposed in logs` | Application logging sensitive config values at startup | Mask secrets in logging output; audit code for accidental secret printing |
56
57## Examples
58
59- "Create an environment configuration system using `.env` files for a Node.js app with SOPS encryption for secrets and validation that all required vars are set."
60- "Generate Kubernetes ConfigMaps and Secrets from environment files for dev, staging, and production namespaces."
61- "Set up a configuration promotion workflow: edit in dev, validate in CI, promote to staging via PR, deploy to production with approval gate."
62
63## Resources
64
65- 12-Factor App config: https://12factor.net/config
66- SOPS encryption: https://github.com/getsops/sops
67- Kubernetes ConfigMaps: https://kubernetes.io/docs/concepts/configuration/configmap/
68- Sealed Secrets: https://github.com/bitnami-labs/sealed-secrets
69- Consul KV: https://developer.hashicorp.com/consul/docs/dynamic-app-config/kv
70
71---
72
73**Source:** [`jeremylongshore/claude-code-plugins-plus-skills`](https://github.com/jeremylongshore/claude-code-plugins-plus-skills) → `skills/.curated/managing-environment-configurations/SKILL.md`
74
75**Also appears in:** `jeremylongshore/claude-code-plugins-plus-skills/plugins/devops/environment-config-manager/skills/managing-environment-configurations/SKILL.md`