|
| 1 | +# Quick Start (GCP DevOps Framework) |
| 2 | + |
| 3 | +## Prereqs |
| 4 | +- GCP project and billing enabled |
| 5 | +- Roles: Project Editor or least-privileged set for Compute, Cloud Run, Cloud SQL, Service Networking, VPC Access |
| 6 | +- `gcloud` authenticated (`gcloud auth login` and `gcloud config set project YOUR_PROJECT`) |
| 7 | +- Terraform >= 1.5 (or use the Docker image we provide) |
| 8 | + |
| 9 | +## Local usage |
| 10 | +```bash |
| 11 | +python -m venv .venv && source .venv/bin/activate |
| 12 | +pip install -r requirements.txt |
| 13 | +``` |
| 14 | + |
| 15 | +### Choose a scenario |
| 16 | + |
| 17 | +**Serverless public (Cloud Run + Cloud SQL private IP):** |
| 18 | +```bash |
| 19 | +cd terraform/serverless_public |
| 20 | +cp terraform.tfvars.example terraform.tfvars |
| 21 | +# Edit project_id, region, db_password, etc. |
| 22 | +terraform init |
| 23 | +terraform apply -auto-approve |
| 24 | +terraform output -json |
| 25 | +``` |
| 26 | + |
| 27 | +**Private MIG (GCE + HTTPS LB + Cloud SQL private IP):** |
| 28 | +```bash |
| 29 | +cd terraform/private_mig |
| 30 | +cp terraform.tfvars.example terraform.tfvars |
| 31 | +# Edit project_id, region, zones, db_password, etc. |
| 32 | +terraform init |
| 33 | +terraform apply -auto-approve |
| 34 | +terraform output -json |
| 35 | +``` |
| 36 | + |
| 37 | +## Python CLI wrapper |
| 38 | +From repo root: |
| 39 | +```bash |
| 40 | +python cli.py init --scenario serverless_public --var-file terraform/serverless_public/terraform.tfvars |
| 41 | +python cli.py deploy --scenario serverless_public --var-file terraform/serverless_public/terraform.tfvars |
| 42 | +python cli.py outputs --scenario serverless_public |
| 43 | +python cli.py destroy --scenario serverless_public |
| 44 | +``` |
| 45 | + |
| 46 | +## Docker workflow |
| 47 | +```bash |
| 48 | +docker build -t gcp-devops-framework . |
| 49 | +# Mount your gcloud config for auth |
| 50 | +make init SCENARIO=private_mig VARS=terraform/private_mig/terraform.tfvars |
| 51 | +make deploy SCENARIO=private_mig VARS=terraform/private_mig/terraform.tfvars |
| 52 | +make outputs SCENARIO=private_mig |
| 53 | +make destroy SCENARIO=private_mig |
| 54 | +``` |
| 55 | + |
| 56 | +> ⚠ Costs: Load balancer, Cloud SQL, NAT, and compute incur charges. Destroy when done. |
0 commit comments