Add dynamic datacenter configuration infrastructure (Phase 1)#268
Draft
Add dynamic datacenter configuration infrastructure (Phase 1)#268
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 1 & 2 of dynamic datacenter configuration:
This lays the groundwork for eliminating manual updates across 14+ template files when adding new datacenters.
Problem
Currently, adding a new Datadog datacenter requires manually updating 14+ CloudFormation template files with:
This is error-prone, time-consuming (~2 hours per datacenter), and doesn't scale.
Phase 1: Foundation ✅
Establishes single source of truth and automation scripts. No template changes - zero risk to production.
Files Added
1.
datacenters.yaml- Centralized Configuration2.
scripts/generate_datacenter_configs.py- Generation Scriptdatacenters.yamland generates CloudFormation snippetsgenerated/directory3.
scripts/validate_datacenters_config.py- Validation Scriptdatacenters.yamlstructure and content4.
scripts/README.md- Complete Documentation5.
.gitignore- Updated to excludegenerated/Phase 2: Template Refactoring ✅
Replaced deeply nested conditionals with clean CloudFormation Mappings pattern.
What Changed
BEFORE (7 levels deep, unmaintainable):
AFTER (Clean, scalable, 3 lines):
Files Refactored (4 core templates)
✅
aws_quickstart/main_extended.yaml✅
aws_quickstart/main_v2.yaml✅
aws_quickstart/main_workflow.yaml✅
aws_organizations/main_organizations.yamlBenefits of Phase 2
✅ Readability: From 7-level nesting → flat, scannable Mappings
✅ Maintainability: Add new datacenter = add one Mappings entry
✅ Scalability: Works with unlimited datacenters
✅ Consistency: Same account ID source used everywhere
✅ Less error-prone: No deeply nested !If chains to maintain
Testing Phase 2
Current Datacenters Included
Impact
Phase 1: Zero risk - infrastructure only, no template changes
Phase 2: Low-medium risk - refactored templates produce same results with better structure
Future Phases (Not in This PR)
Benefits After Full Implementation
Requirements
pip install pyyaml)How to Test Locally
Phase 1 - Generate configs:
Phase 2 - Deploy templates:
Migration Path for Adding New Datacenter
BEFORE this PR (manual - error prone):
AFTER this PR (partially automated):
datacenters.yamlFUTURE (fully automated - Phase 3+4):
datacenters.yamlRelated
/Users/kyle.harris/.claude/plans/nifty-twirling-hamster.md