Skip to content

Make deployment region configurable via gapp setup #1

@krisrowe

Description

@krisrowe

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:96 sets region = "us-central1" — affects Artifact Registry paths and is passed implicitly to Terraform via image URL
  • Terraform module already accepts a region variable with default "us-central1", but it's never populated from Python
  • solutions.yaml stores only project_id and repo_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 infrastructure
  • gapp status currently reads TF outputs from remote state — region-agnostic. But if we ever add gcloud run queries directly, they'll need region.
  • Cloud Build currently doesn't specify region (uses default). May want to align with deploy region.

Recommendation

  • Make --region required on gapp setup when no region is already stored
  • Default existing solutions to us-central1 for 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions