How jojoooo1/cloud-diplomats-terraform-commons works
Project type and purpose
• This is a Terraform–based Infrastructure-as-Code (IaC) project whose goal is to automate the setup of a Google Cloud Platform (GCP) Organization’s folder hierarchy, organization-level policies, and GCP projects (split by “commons”, “development”, and “production” scopes).
• Key indicators: directories named “folders-and-policies” and “projects,” each containing Terraform files (common.tf, main.tf, variables.tf, outputs.tf, tf.example), plus README links to blog posts on “Terraforming GCP folders” and “Terraforming GCP projects.”
File structure
• Top-level modules:
• folders-and-policies/ → creates GCP Organization folders and applies org policies
• projects/ → contains subdirectories for different project types
• Under projects/:
• commons/ → reusable common-service modules (dns, oauth, workload-identity-federation)
• development/ → environment-specific projects (services, shared)
• production/ → environment-specific projects (services)
• Each module folder has: .pre-commit-config.yaml (linting), common.tf (shared definitions), main.tf (resource definitions), variables.tf (inputs), outputs.tf (outputs), tf.example (usage example).
README for additional insights
• The README simply points to Medium articles explaining how the Terraform code structures GCP organization, folders, org policies, and projects.
Elements
• Clear, consistent labels for each Terraform module/folder (e.g., “folders-and-policies”, “projects/commons/dns”, etc.)
• From CI/CD to Terraform modules
• Between modules (folder outputs → project inputs)
• From Terraform modules to GCP entities (Organization, Folders, Projects, APIs)
• Blue rectangles for Terraform modules