mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-30 01:08:33 +00:00
* feat(terraform/gcp): add dependencies-only mode Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(terraform/gcp): review fixes for dependencies-only mode Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: yassin <yassin@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
45 lines
1.4 KiB
HCL
45 lines
1.4 KiB
HCL
# Auto-runs the prisma schema migration as part of `terraform apply`. Mirrors
|
|
# the AWS stack's terraform_data.migration in spirit. Cloud SQL doesn't need a
|
|
# separate user-bootstrap step because google_sql_user.app already creates the
|
|
# application user — so the only post-cluster work is the migration.
|
|
#
|
|
# Gateway/backend Cloud Run services depend on this resource (in cloudrun.tf)
|
|
# so they don't go live until the schema is in place.
|
|
#
|
|
# Triggers:
|
|
# - re-runs if the migrations image changes (new release ships new prisma
|
|
# migration files).
|
|
# - re-runs if the migration job is recreated.
|
|
#
|
|
# Requires `gcloud` on the machine running terraform, with user creds live
|
|
# enough to invoke Cloud Run admin APIs (`gcloud auth login`).
|
|
|
|
resource "terraform_data" "migration" {
|
|
count = var.create_runtime ? 1 : 0
|
|
|
|
triggers_replace = {
|
|
job_id = google_cloud_run_v2_job.migrations[0].id
|
|
job_image = local.migrations_image
|
|
}
|
|
|
|
provisioner "local-exec" {
|
|
interpreter = ["bash", "-c"]
|
|
environment = {
|
|
JOB = google_cloud_run_v2_job.migrations[0].name
|
|
REGION = var.region
|
|
PROJECT = var.project_id
|
|
}
|
|
command = <<-EOT
|
|
set -euo pipefail
|
|
gcloud run jobs execute "$JOB" \
|
|
--region "$REGION" \
|
|
--project "$PROJECT" \
|
|
--wait
|
|
EOT
|
|
}
|
|
|
|
depends_on = [
|
|
google_cloud_run_v2_job.migrations,
|
|
google_sql_user.app,
|
|
]
|
|
}
|