Skip to content

fix(28): move Cloud Run max_instance_count into template.scaling (provider 6.50.0)#95

Merged
helloiamvu merged 4 commits into
mainfrom
claude/hungry-maxwell-1ed4fa
Jul 3, 2026
Merged

fix(28): move Cloud Run max_instance_count into template.scaling (provider 6.50.0)#95
helloiamvu merged 4 commits into
mainfrom
claude/hungry-maxwell-1ed4fa

Conversation

@helloiamvu

Copy link
Copy Markdown
Member

Problem

tofu -chdir=infra validate (OpenTofu, pinned hashicorp/google 6.50.0) fails with:

An argument named "max_instance_count" is not expected here

blocking tofu apply for the entire Phase 28 hosted platform. Under 6.50.0, google_cloud_run_v2_service's top-level scaling block only accepts min_instance_count / manual_instance_count / scaling_mode — autoscaling max belongs in template { scaling { max_instance_count = ... } } (verified directly against the 6.50.0 provider schema).

Pre-existing on main (merged in #92), independent of the deploy-runtime-layer branch.

Fix

Move min_instance_count + max_instance_count into each service's template.scaling block. Placement-only — no scaling values changed. Affects all three google_cloud_run_v2_service resources:

Resource min / max note
earnings_serving 1 / 1 had the same bug (not just the two originally reported)
weather_serving 0 / var.serving_rest_max_instances
stt 0 / var.stt_max_concurrency

Keeping min+max together as revision-level autoscaling bounds is the canonical pattern and stays consistent with the scheduler's --min-instances 0↔1 flip (which patches the revision template).

Verification

  • tofu -chdir=infra validate0 cloud_run.tf errors (was 3).
  • tofu fmt -check cloud_run.tf → clean.

Out of scope (flagging, not fixed here)

tofu validate still reports one unrelated, pre-existing error: batch.tf:72 google_batch_job is not in the google-beta 6.50.0 schema (resource sets provider = google-beta). Different resource, different root cause — worth a separate follow-up as it also blocks the weather-backfill Batch job's apply.

🤖 Generated with Claude Code

…provider 6.50.0

The pinned hashicorp/google 6.50.0 schema does not accept max_instance_count
in the TOP-LEVEL `scaling` block of google_cloud_run_v2_service (that block
only supports min_instance_count / manual_instance_count / scaling_mode);
autoscaling max belongs in `template { scaling { ... } }`. `tofu validate`
failed with "An argument named max_instance_count is not expected here" at
all three services, blocking Phase 28 `tofu apply`.

Move min+max_instance_count into each service's template.scaling block,
keeping the same values (earnings_serving min=1/max=1, weather_serving
min=0/max=var, stt min=0/max=var). earnings_serving had the same bug, not
just weather_serving and stt. Placement-only change; no value changes.

`tofu -chdir=infra validate` now reports 0 cloud_run.tf errors.

Pre-existing on main (PR #92), independent of the deploy-runtime-layer branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@helloiamvu helloiamvu requested a review from Tarabcak July 3, 2026 19:59
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Parity ticket gate: PASSED

parity-ticket-check: PR does not touch parity-trigger surface; gate skipped.

See CROSS-SDK-SYNC.md §2 for the workflow.

…uler cool-down

Codex P2: moving min_instance_count into template.scaling decoupled it from
scheduler.tf, which PATCHes the service-level scaling.minInstanceCount to flip
the live-window warm/cool 0<->1. A revision-level min would pin the SSE
instance warm 24/7. Keep min at service level; only max moves to
template.scaling (max is invalid on the service-level block).
…invalid max)

Codex P1: the warm/cool PATCH bodies sent
{"scaling":{"minInstanceCount":N,"maxInstanceCount":1}} to the service-level
scaling field. maxInstanceCount is not a valid service-level ServiceScaling
field (it is revision-level, template.scaling in cloud_run.tf) and is outside
the updateMask=scaling.minInstanceCount, so it risks a 400 that stalls the SSE
warm/cool automation. Send only minInstanceCount.
@helloiamvu helloiamvu merged commit 0793856 into main Jul 3, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant