Overview
The Halo Cross-Media Measurement System provides Terraform modules and examples for provisioning cloud infrastructure on both Google Cloud Platform (GKE) and Amazon Web Services (EKS).Terraform configurations are located in the source repository:
- GKE:
src/main/terraform/gcloud/ - EKS:
src/main/terraform/aws/
Repository Structure
The Terraform code is organized into reusable modules and examples:Getting Started
Configure Backend
Add backend configuration to persist Terraform state.
Create the storage bucket manually before running
terraform init.GKE Configuration Examples
Kingdom on GKE
The Kingdom example creates:- GKE Cluster named
kingdom - Cloud Spanner Instance with 1000 processing units (Enterprise edition)
- KMS Key Ring for encryption
- Node Pool with e2-custom-2-4096 instances (max 2 nodes)
Duchy on GKE
The Duchy example creates:- GKE Cluster named
{duchy-name}-duchy - Cloud Spanner Instance for computation storage
- Cloud Storage Bucket for blob storage
- Two Node Pools:
- Default: e2-standard-2 (max 2 nodes)
- Spot: c2-standard-4 (max 20 nodes) for computation mills
EKS Configuration Examples
Duchy on EKS
The Duchy example creates:- VPC with multi-AZ subnets (public, private, database, intra)
- EKS Cluster (v1.29) with managed node groups
- RDS PostgreSQL instance for computation storage
- S3 Bucket for blob storage
- Load Balancer Controller for service exposure
Variable Configuration
Customize deployments using variables:State Management
Remote State Best Practices
Multi-Environment Management
Manage multiple environments (dev, staging, prod) using workspaces or separate state files:Using Terraform Workspaces
Using Separate Directories
Common Operations
Plan Changes
Import Existing Resources
Destroy Resources
Troubleshooting
State Lock Issues
State Lock Issues
If state is locked:
Provider Version Conflicts
Provider Version Conflicts
Pin provider versions in
versions.tf:Quota Exceeded Errors
Quota Exceeded Errors
Request quota increases in cloud console:
- GKE: Increase CPU, IP address quotas
- EKS: Increase VPC, Elastic IP quotas
Security Best Practices
Never Commit Secrets
- Add
*.tfvarsto.gitignore - Use secret management services
- Reference secrets via data sources
Advanced Patterns
Using Data Sources
Reference existing resources:Dynamic Blocks
Generate repeated configuration:Module Composition
Build complex infrastructure from simple modules:Next Steps
Deploy Kingdom
Use Terraform to deploy Kingdom infrastructure
Deploy Duchy
Use Terraform to deploy Duchy infrastructure
Terraform Docs
Official Terraform documentation
GKE Modules
Google Cloud provider documentation