|
1 | | -# terraform-apigee-enterprise-stack |
2 | | -Production-grade Terraform Stack for Apigee X on GCP (Enterprise-ready, opinionated, secure-by-default) |
| 1 | +# Terraform Apigee Enterprise Stack (GCP) - Production-Grade Terraform Stacks Reference Architecture |
| 2 | + |
| 3 | +**terraform-apigee-enterprise-stack** is an opinionated, **enterprise-ready** reference implementation for deploying **Apigee X on Google Cloud (GCP)** using **Terraform Stacks**. |
| 4 | +It gives platform teams a repeatable way to provision **Apigee Org, Instances, Environments, EnvGroups, networking, DNS, IAM, and KMS (CMEK)** with secure-by-default patterns. |
| 5 | + |
| 6 | +> Keywords: Terraform Apigee X, Apigee Terraform, Apigee X Terraform Stack, GCP API Management Terraform, Apigee enterprise architecture, Apigee landing zone, Apigee private ingress, Apigee CMEK, Apigee multi-region HA. |
| 7 | +
|
| 8 | +--- |
| 9 | + |
| 10 | +## Why this repository exists |
| 11 | + |
| 12 | +Many Apigee Terraform examples are either low-level or incomplete for enterprise rollouts. This stack provides: |
| 13 | + |
| 14 | +- **Terraform Stacks-first** structure for platform engineering and multi-environment workflows |
| 15 | +- **Secure-by-default** networking patterns (private ingress, controlled egress, IAM least privilege) |
| 16 | +- **Enterprise readiness**: CMEK, logging/monitoring hooks, clear separation of duties, production checklists |
| 17 | +- **Battle-tested repo hygiene**: examples, docs, diagrams, changelog, CI scaffolding |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## What you can deploy |
| 22 | + |
| 23 | +### Apigee control plane (platform) |
| 24 | +- Apigee Org (existing Google Cloud Org / project model) |
| 25 | +- Apigee X Instances (single region or multi-region) |
| 26 | +- Apigee Environments and EnvGroups |
| 27 | +- Hostnames + DNS record structure (authoritative DNS external to this repo is supported) |
| 28 | + |
| 29 | +### Enterprise foundations |
| 30 | +- Networking patterns for Apigee runtime access (**private ingress** supported) |
| 31 | +- **Cloud KMS (CMEK)** for supported resources (where applicable) |
| 32 | +- IAM roles and service accounts for platform vs application teams |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Architecture diagrams |
| 37 | + |
| 38 | +- **Single-region production**: `diagrams/png/apigee-single-region.png` |
| 39 | +- **Multi-region HA**: `diagrams/png/apigee-multi-region-ha.png` |
| 40 | +- **CI/CD + Policy**: `diagrams/png/apigee-cicd-policy.png` |
| 41 | + |
| 42 | +Mermaid sources: |
| 43 | +- `diagrams/mermaid/apigee-single-region.mmd` |
| 44 | +- `diagrams/mermaid/apigee-multi-region-ha.mmd` |
| 45 | +- `diagrams/mermaid/apigee-cicd-policy.mmd` |
| 46 | + |
| 47 | +## Docs (MkDocs) |
| 48 | + |
| 49 | +The docs live in `docs/` and can be published with MkDocs. |
| 50 | + |
| 51 | +Local preview: |
| 52 | + |
| 53 | +``` |
| 54 | +mkdocs serve |
| 55 | +``` |
| 56 | + |
| 57 | +Deploy to GitHub Pages: |
| 58 | + |
| 59 | +``` |
| 60 | +mkdocs gh-deploy --force |
| 61 | +``` |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## Repository layout |
| 66 | + |
| 67 | +```text |
| 68 | +terraform-apigee-enterprise-stack/ |
| 69 | +├── stacks/ |
| 70 | +│ ├── apigee-platform/ # Apigee control plane + foundation components |
| 71 | +│ │ ├── stack.hcl # Terraform Stacks entrypoint |
| 72 | +│ │ ├── variables.tf |
| 73 | +│ │ ├── outputs.tf |
| 74 | +│ │ └── components/ |
| 75 | +│ │ ├── iam/ |
| 76 | +│ │ ├── kms/ |
| 77 | +│ │ ├── networking/ |
| 78 | +│ │ ├── org/ |
| 79 | +│ │ ├── instances/ |
| 80 | +│ │ ├── environments/ |
| 81 | +│ │ └── envgroups/ |
| 82 | +│ └── runtime/ # Optional runtime ingress/DNS patterns |
| 83 | +│ ├── stack.hcl |
| 84 | +│ ├── components/ |
| 85 | +│ │ ├── ingress/ |
| 86 | +│ │ ├── dns/ |
| 87 | +│ │ └── observability/ |
| 88 | +├── policies/ # Policy-as-code examples (OPA/Conftest-ready) |
| 89 | +├── examples/ # End-to-end example deployments |
| 90 | +├── docs/ # Enterprise documentation |
| 91 | +├── diagrams/ # Mermaid + PNG diagrams |
| 92 | +└── .github/workflows/ # CI scaffolding (fmt, validate, docs) |
| 93 | +``` |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## Quickstart (10-15 minutes) |
| 98 | + |
| 99 | +> This repo is designed for **platform engineering teams**. If you are new to Apigee X, start with the docs: `docs/01-overview.md`. |
| 100 | +
|
| 101 | +### Prerequisites |
| 102 | +- Terraform >= 1.6 |
| 103 | +- Google Cloud project(s) + permissions |
| 104 | +- Apigee API enabled |
| 105 | +- A VPC strategy decided (shared VPC recommended for enterprises) |
| 106 | + |
| 107 | +### Steps |
| 108 | +1. Clone and enter the repo |
| 109 | +2. Copy an example: |
| 110 | + - `examples/single-region/` (recommended first) |
| 111 | +3. Populate `terraform.tfvars` |
| 112 | +4. Run: |
| 113 | + - `terraform init` |
| 114 | + - `terraform plan` |
| 115 | + - `terraform apply` |
| 116 | + |
| 117 | +> Terraform Stacks workflow depends on your Terraform Stacks runtime (Terraform Cloud/Enterprise, or local stacks toolchain if available in your environment). |
| 118 | +> This repo includes both **Stacks structure** and **plain Terraform module execution** paths. |
| 119 | +
|
| 120 | +--- |
| 121 | + |
| 122 | +## Production checklist |
| 123 | + |
| 124 | +See: `docs/06-production-checklist.md` |
| 125 | + |
| 126 | +Highlights: |
| 127 | +- Enable CMEK where supported |
| 128 | +- Separate projects for platform vs app teams |
| 129 | +- Centralized logging/monitoring and alerting |
| 130 | +- Define hostname strategy and certificate lifecycle |
| 131 | +- Adopt policy-as-code and drift detection |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +## Security & compliance |
| 136 | + |
| 137 | +- Least-privilege IAM patterns in `stacks/apigee-platform/components/iam` |
| 138 | +- CMEK/KMS scaffolding in `stacks/apigee-platform/components/kms` |
| 139 | +- Policy examples in `policies/` |
| 140 | + |
| 141 | +See: `docs/05-security.md` |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## Examples |
| 146 | + |
| 147 | +- `examples/single-region/` - single region baseline (prod-ready starter) |
| 148 | +- `examples/multi-region-ha/` - multi-region HA pattern (active/active-ish routing patterns) |
| 149 | + |
| 150 | +--- |
| 151 | + |
| 152 | +## Roadmap |
| 153 | + |
| 154 | +- v1.0: Single-region platform stack + private ingress patterns + docs |
| 155 | +- v1.1: Multi-region HA reference + runbooks |
| 156 | +- v1.2: GitHub/GitLab CI templates + policy gate examples |
| 157 | +- v2.0: Apigee Edge -> X migration helper docs and scripts |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +## Contributing |
| 162 | + |
| 163 | +PRs welcome. Please read `CONTRIBUTING.md` and open an issue for architectural changes. |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## License |
| 168 | + |
| 169 | +MIT. See `LICENSE`. |
0 commit comments