-
Notifications
You must be signed in to change notification settings - Fork 0
Make deployment region configurable via gapp setup #1
Copy link
Copy link
Open
Description
Region is hardcoded as us-central1 in deploy.py (line 96). It should be configurable via gapp setup --region and stored in solutions.yaml.
Current State
- One hardcoded location:
deploy.py:96setsregion = "us-central1"— affects Artifact Registry paths and is passed implicitly to Terraform via image URL - Terraform module already accepts a
regionvariable with default"us-central1", but it's never populated from Python - solutions.yaml stores only
project_idandrepo_path— no region field - context.resolve_solution() returns
{name, project_id, repo_path}— no region propagation - GCS buckets are multi-regional (
--location us), region-agnostic naming — safe - Artifact Registry image paths embed the region (
us-central1-docker.pkg.dev/...) — hard dependency
What Needs Updating
| Component | Change Needed |
|---|---|
solutions.yaml |
Add optional region field (default us-central1) |
context.resolve_solution() |
Propagate region through context dict |
deploy.py |
Read region from context instead of hardcoding |
_build_tfvars() |
Pass region to Terraform |
gapp setup |
Accept --region flag, store in solutions.yaml |
gapp solutions list |
Display region |
gapp status |
Show region in output |
What's Safe / Unaffected
- GCS buckets — multi-regional, no region in naming
- Terraform state — region-agnostic backend config
- Secret Manager — project-scoped, not region-scoped
- GCP discovery (label-based) — no region filters
Key Risks
- Artifact Registry image paths embed region. Changing region on an existing deployment orphans old images. Must either prevent mid-lifecycle region changes or implement migration logic.
gapp solutions restore(not yet implemented) and any future import/reattach flows will need to discover or infer region from existing infrastructuregapp statuscurrently reads TF outputs from remote state — region-agnostic. But if we ever addgcloud runqueries directly, they'll need region.- Cloud Build currently doesn't specify region (uses default). May want to align with deploy region.
Recommendation
- Make
--regionrequired ongapp setupwhen no region is already stored - Default existing solutions to
us-central1for backward compatibility - Add validation to reject region changes after first deploy (Artifact Registry images are region-locked)
- Keep GCS buckets multi-regional for now — no reason to couple bucket location to service region
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels