Skip to content

fix(vertexai): implement Read for EndpointWithModelGardenDeployment - #18547

Open
syangcode wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
syangcode:fix/vertex-ai-mg-deployment-read-support
Open

fix(vertexai): implement Read for EndpointWithModelGardenDeployment#18547
syangcode wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
syangcode:fix/vertex-ai-mg-deployment-read-support

Conversation

@syangcode

@syangcode syangcode commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The resource is generated with exclude_read: true, so the generated Read is a no-op (return nil). State is never reconciled against the live Endpoint, so out-of-band changes go unnoticed and terraform plan reports "No changes" even when the deployment has drifted.

This wires Read up, but reads back only the replica counts.

Why only the replica counts

Almost every field on this resource is immutable. The only ones the API can change in place are those mutateDeployedModel accepts, which #18116 already wired into Update. A difference anywhere else could only mean the deployment was replaced out of band, and that case is already covered by clearing the id when the DeployedModel is gone.

This covers the drift-detection half of hashicorp/terraform-provider-google#27250. The in-place update half shipped in #18116.

vertexai: fixed `google_vertex_ai_endpoint_with_model_garden_deployment` not detecting drift in replica counts, because the resource had no Read implementation; out-of-band changes to `min_replica_count`, `max_replica_count` and `required_replica_count` are now surfaced on `terraform plan`

Testing

Tested by hand against a live deployment (paligemma-224-float32 on g2-standard-12 + NVIDIA_L4, us-west1):

  1. After apply, state and the API both report min/max = 1 2.
  2. terraform plan is clean, exit 0. Worth checking separately from step 4, since a decoder that catches real drift but also introduces phantom diffs would be a net regression.
  3. Bumped maxReplicaCount to 4 out of band via endpoints:mutateDeployedModel.
  4. terraform plan exits 2 and reports ~ max_replica_count = 4 -> 2.

Step 4 exits 0 with "No changes" on released v7.42.0.

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 6, 2026
@c2thorn

c2thorn commented Aug 6, 2026

Copy link
Copy Markdown
Member

Github actions was done earlier today. Starting the build now.

@modular-magician modular-magician added service/aiplatform-prediction and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Aug 6, 2026
@modular-magician

modular-magician commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit a31310d:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 1 file changed, 229 insertions(+), 2 deletions(-)
google-beta provider View Diff 1 file changed, 229 insertions(+), 2 deletions(-)

Test report

Analytics

Total Tests Passed Skipped Affected
113 99 7 7
Affected Service Packages
  • vertexai

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 7 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccVertexAIEndpointWithModelGardenDeployment_basic
  • TestAccVertexAIEndpointWithModelGardenDeployment_huggingfaceModel
  • TestAccVertexAIEndpointWithModelGardenDeployment_multipleModelsInSequence
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
  • TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
  • TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_basic
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_huggingfaceModel
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_multipleModelsInSequence
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
❌ Error · Log - TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@syangcode VCR tests complete for a31310d!

@c2thorn c2thorn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

       Error: Error waiting to create EndpointWithModelGardenDeployment: Error waiting for Creating EndpointWithModelGardenDeployment: Error code 13, message: Internal error occurred. Contact Vertex AI.

Any idea @syangcode ?

@syangcode
syangcode force-pushed the fix/vertex-ai-mg-deployment-read-support branch from a31310d to 1ce1eab Compare August 10, 2026 16:21
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 10, 2026
@github-actions
github-actions Bot requested a review from c2thorn August 10, 2026 16:21
@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 10, 2026
@modular-magician

modular-magician commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 1ce1eab:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 1 file changed, 233 insertions(+), 2 deletions(-)
google-beta provider View Diff 1 file changed, 233 insertions(+), 2 deletions(-)

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_vertex_ai_endpoint_with_model_garden_deployment (10 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_vertex_ai_endpoint_with_model_garden_deployment" "primary" {
  model_config {
    hugging_face_cache_enabled = # value needed
    model_display_name         = # value needed
  }
}

Test report

Analytics

Total Tests Passed Skipped Affected
113 99 7 7
Affected Service Packages
  • vertexai

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 7 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccVertexAIEndpointWithModelGardenDeployment_basic
  • TestAccVertexAIEndpointWithModelGardenDeployment_huggingfaceModel
  • TestAccVertexAIEndpointWithModelGardenDeployment_multipleModelsInSequence
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
  • TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
  • TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccVertexAIEndpointWithModelGardenDeployment_huggingfaceModel
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_basic
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_multipleModelsInSequence
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
❌ Error · Log - TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@syangcode, @c2thorn VCR tests complete for 1ce1eab!

@syangcode
syangcode force-pushed the fix/vertex-ai-mg-deployment-read-support branch from 1ce1eab to 989be23 Compare August 10, 2026 20:59
@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Aug 10, 2026
@modular-magician

modular-magician commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 989be23:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 1 file changed, 244 insertions(+), 8 deletions(-)
google-beta provider View Diff 1 file changed, 244 insertions(+), 8 deletions(-)

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_vertex_ai_endpoint_with_model_garden_deployment (10 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_vertex_ai_endpoint_with_model_garden_deployment" "primary" {
  deploy_config {
    dedicated_resources {
      machine_spec {
        multihost_gpu_node_count = # value needed
      }
      required_replica_count = # value needed
      spot                   = # value needed
    }
    fast_tryout_enabled = # value needed
    system_labels       = # value needed
  }
  model_config {
    hugging_face_cache_enabled = # value needed
    model_display_name         = # value needed
  }
}

Test report

Analytics

Total Tests Passed Skipped Affected
113 100 7 6
Affected Service Packages
  • vertexai

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccVertexAIEndpointWithModelGardenDeployment_basic
  • TestAccVertexAIEndpointWithModelGardenDeployment_multipleModelsInSequence
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
  • TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
  • TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_basic
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_multipleModelsInSequence
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
❌ Error · Log - TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@syangcode, @c2thorn VCR tests complete for 989be23!

@syangcode
syangcode force-pushed the fix/vertex-ai-mg-deployment-read-support branch from 989be23 to 39bf995 Compare August 12, 2026 19:18
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 12, 2026
@syangcode

Copy link
Copy Markdown
Contributor Author

Hi @c2thorn could you please help to rebuild?

@c2thorn

c2thorn commented Aug 12, 2026

Copy link
Copy Markdown
Member

Hi @c2thorn could you please help to rebuild?

started the build (it's in queue)

FYI go/terraform-contribution-guide#before-you-begin outlines steps to get automatic build approvals

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 12, 2026
@modular-magician

modular-magician commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 39bf995:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 1 file changed, 238 insertions(+), 2 deletions(-)
google-beta provider View Diff 1 file changed, 238 insertions(+), 2 deletions(-)

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_vertex_ai_endpoint_with_model_garden_deployment (10 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_vertex_ai_endpoint_with_model_garden_deployment" "primary" {
  deploy_config {
    system_labels = # value needed
  }
  model_config {
    hugging_face_cache_enabled = # value needed
    model_display_name         = # value needed
  }
}

Test report

Analytics

Total Tests Passed Skipped Affected
113 100 7 6
Affected Service Packages
  • vertexai

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccVertexAIEndpointWithModelGardenDeployment_basic
  • TestAccVertexAIEndpointWithModelGardenDeployment_multipleModelsInSequence
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
  • TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
  • TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccVertexAIEndpointWithModelGardenDeployment_multipleModelsInSequence
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_basic
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
❌ Error · Log - TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@syangcode, @c2thorn VCR tests complete for 39bf995!

@github-actions

Copy link
Copy Markdown

@c2thorn This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@c2thorn c2thorn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@syangcode do you know how we can fix the failing TestAccVertexAIEndpointWithModelGardenDeployment tests? We are making a significant change to the ModelGardenDeployment resource, so now is the time to repair them.

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 14, 2026
@github-actions
github-actions Bot requested a review from c2thorn August 14, 2026 23:50
@syangcode
syangcode force-pushed the fix/vertex-ai-mg-deployment-read-support branch 4 times, most recently from 4070db8 to 26214af Compare August 17, 2026 18:33
@syangcode
syangcode force-pushed the fix/vertex-ai-mg-deployment-read-support branch from 26214af to c153650 Compare August 17, 2026 18:42
…ployment

exclude_read: true made the generated Read a no-op, so state was never
reconciled against the live Endpoint and terraform plan reported "No changes"
even after the deployment had drifted.

Adds a decoder that reads min, max and required replica count off the
DeployedModel matching deployed_model_id, and clears the id when that model is
gone. Those are the only fields mutateDeployedModel can change, so they are the
only ones worth reading.

Everything else is immutable and the Endpoint response does not carry most of
it, so model_config, endpoint_config and machine_spec are kept from state by
custom flatteners rather than read back. deploy_config and max_replica_count
are default_from_api to absorb what the API supplies when a config omits them.

Covers the drift-detection half of
hashicorp/terraform-provider-google#27250.
@syangcode
syangcode force-pushed the fix/vertex-ai-mg-deployment-read-support branch from c153650 to 069e656 Compare August 17, 2026 18:46
@syangcode

Copy link
Copy Markdown
Contributor Author

@c2thorn, I believe these tests require the L4 GPU quota in your CI projects, Could you please run

gcloud alpha quotas info describe CustomModelServingL4GPUsPerProjectPerRegion \
  --service=aiplatform.googleapis.com --project=ci-test-project-188019

And increase the quota for us-central1 region? Thanks

@c2thorn

c2thorn commented Aug 18, 2026

Copy link
Copy Markdown
Member

@c2thorn, I believe these tests require the L4 GPU quota in your CI projects, Could you please run

gcloud alpha quotas info describe CustomModelServingL4GPUsPerProjectPerRegion \
  --service=aiplatform.googleapis.com --project=ci-test-project-188019

And increase the quota for us-central1 region? Thanks

doubled the quota from 28 -> 56. I'll retry.

@c2thorn

c2thorn commented Aug 18, 2026

Copy link
Copy Markdown
Member

/gcbrun

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 18, 2026
@modular-magician

modular-magician commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 069e656:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 1 file changed, 273 insertions(+), 1308 deletions(-)
google-beta provider View Diff 1 file changed, 273 insertions(+), 1308 deletions(-)

Test report

Analytics

Total Tests Passed Skipped Affected
113 101 7 5
Affected Service Packages
  • vertexai

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccVertexAIEndpointWithModelGardenDeployment_basic
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
  • TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
  • TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_basic
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
❌ Error · Log - TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@syangcode, @c2thorn VCR tests complete for 069e656!

@github-actions

Copy link
Copy Markdown

@c2thorn This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@rileykarson

Copy link
Copy Markdown
Member

We’re currently requesting a change in process for Googlers (or individuals on behalf of Googlers) contributing changes to the Terraform Provider for Google Cloud. Please see go/terraform-ssp-adjustment for details.

@c2thorn c2thorn reopened this Aug 19, 2026
@c2thorn

c2thorn commented Aug 19, 2026

Copy link
Copy Markdown
Member

reopening as this is a continuation from b/514579514

@c2thorn

c2thorn commented Aug 19, 2026

Copy link
Copy Markdown
Member

doubled the quota from 28 -> 56. I'll retry.

@syangcode I increased the quota but no difference on the tests.

@modular-magician

modular-magician commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 069e656:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 1 file changed, 273 insertions(+), 1308 deletions(-)
google-beta provider View Diff 1 file changed, 273 insertions(+), 1308 deletions(-)

Test report

Analytics

Total Tests Passed Skipped Affected
113 101 7 5
Affected Service Packages
  • vertexai

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccVertexAIEndpointWithModelGardenDeployment_basic
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
  • TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
  • TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
  • TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_basic
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpoint
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_pscEndpointAutomated
❌ Error · Log - TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs
❌ Error · Log - TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@syangcode, @c2thorn VCR tests complete for 069e656!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants