2 KiB
2 KiB
Coding Principles for Symphony DevOps (Infrastructure as Code & Scripts)
- Simplicity & Readability: IaC and scripts should be clear, well-commented, and easy to understand. Avoid overly complex logic.
- DRY (Don't Repeat Yourself): Use modules, templates, functions, and variables effectively in IaC and scripts to avoid duplication.
- Environment Awareness & Parameterization: Hardcoding is forbidden. Use variables and parameter files extensively to manage differences between environments (dev, staging, prod).
- Idempotency: Infrastructure changes (IaC) and configuration scripts should be idempotent whenever possible (running them multiple times should result in the same state).
- Pattern Consistency: Follow established patterns for the chosen IaC tools (e.g., Terraform modules, Ansible roles). Use consistent naming conventions.
- Modularity & Low Coupling: Break down infrastructure into logical, reusable modules (e.g., networking, compute, database). Minimize dependencies between modules.
- Configuration Safety & Secrets Management: NEVER commit secrets directly into code. Use secure secret management solutions (e.g., Vault, AWS Secrets Manager, Azure Key Vault) referenced in configurations. Access controls must be strict.
- Testing Rigor (for IaC/Scripts): Use linting tools. Perform static analysis. Implement integration tests for critical infrastructure components or scripts where feasible. Plan for manual verification steps post-deployment.
- Impact Analysis: Before applying changes (especially to production), use tool-specific planning features (e.g.,
terraform plan,ansible --check) to understand the potential impact. - Documentation: Document infrastructure architecture, pipeline design (including Mermaid diagrams), environment setup, operational procedures, and runbooks clearly in the designated
symphony-[project-slug]/locations. Keep IaC code well-commented. Log deployment actions with timestamps.