Skip to content

Commit d3cdce4

Browse files
Add Endpoint for Vertex Model Garden OSS Gen AI model deployment (#14416) (#10365)
[upstream:d29bf71031d68ad7908d19edce39f27701722143] Signed-off-by: Modular Magician <[email protected]>
1 parent 388e445 commit d3cdce4

6 files changed

+5422
-2
lines changed

.changelog/14416.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_vertex_ai_endpoint_with_model_garden_deployment`
3+
```

google-beta/provider/provider_mmv1_resources.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
595595
}
596596

597597
// Resources
598-
// Generated resources: 687
598+
// Generated resources: 688
599599
// Generated IAM resources: 339
600-
// Total generated resources: 1026
600+
// Total generated resources: 1027
601601
var generatedResources = map[string]*schema.Resource{
602602
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
603603
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
@@ -1575,6 +1575,7 @@ var generatedResources = map[string]*schema.Resource{
15751575
"google_vertex_ai_endpoint_iam_binding": tpgiamresource.ResourceIamBinding(vertexai.VertexAIEndpointIamSchema, vertexai.VertexAIEndpointIamUpdaterProducer, vertexai.VertexAIEndpointIdParseFunc),
15761576
"google_vertex_ai_endpoint_iam_member": tpgiamresource.ResourceIamMember(vertexai.VertexAIEndpointIamSchema, vertexai.VertexAIEndpointIamUpdaterProducer, vertexai.VertexAIEndpointIdParseFunc),
15771577
"google_vertex_ai_endpoint_iam_policy": tpgiamresource.ResourceIamPolicy(vertexai.VertexAIEndpointIamSchema, vertexai.VertexAIEndpointIamUpdaterProducer, vertexai.VertexAIEndpointIdParseFunc),
1578+
"google_vertex_ai_endpoint_with_model_garden_deployment": vertexai.ResourceVertexAIEndpointWithModelGardenDeployment(),
15781579
"google_vertex_ai_feature_group": vertexai.ResourceVertexAIFeatureGroup(),
15791580
"google_vertex_ai_feature_group_iam_binding": tpgiamresource.ResourceIamBinding(vertexai.VertexAIFeatureGroupIamSchema, vertexai.VertexAIFeatureGroupIamUpdaterProducer, vertexai.VertexAIFeatureGroupIdParseFunc),
15801581
"google_vertex_ai_feature_group_iam_member": tpgiamresource.ResourceIamMember(vertexai.VertexAIFeatureGroupIamSchema, vertexai.VertexAIFeatureGroupIamUpdaterProducer, vertexai.VertexAIFeatureGroupIdParseFunc),
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
// ----------------------------------------------------------------------------
4+
//
5+
// *** AUTO GENERATED CODE *** Type: Handwritten ***
6+
//
7+
// ----------------------------------------------------------------------------
8+
//
9+
// This code is generated by Magic Modules using the following:
10+
//
11+
// Source file: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_deploy_test.go
12+
//
13+
// DO NOT EDIT this file directly. Any changes made to this file will be
14+
// overwritten during the next generation cycle.
15+
//
16+
// ----------------------------------------------------------------------------
17+
package vertexai_test
18+
19+
import (
20+
"testing"
21+
22+
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
23+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest"
24+
)
25+
26+
func TestAccVertexAIEndpointWithModelGardenDeployment_basic(t *testing.T) {
27+
t.Parallel()
28+
29+
context := map[string]interface{}{
30+
"random_suffix": acctest.RandString(t, 10),
31+
}
32+
33+
acctest.VcrTest(t, resource.TestCase{
34+
PreCheck: func() { acctest.AccTestPreCheck(t) },
35+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
36+
CheckDestroy: nil, // the resource does not yet support deletion
37+
Steps: []resource.TestStep{
38+
{
39+
Config: testAccVertexAIEndpointWithModelGardenDeployment_basic(context),
40+
},
41+
},
42+
})
43+
}
44+
45+
func testAccVertexAIEndpointWithModelGardenDeployment_basic(context map[string]interface{}) string {
46+
return acctest.Nprintf(`
47+
resource "google_vertex_ai_endpoint_with_model_garden_deployment" "test" {
48+
publisher_model_name = "publishers/google/models/paligemma@paligemma-224-float32"
49+
location = "us-central1"
50+
model_config {
51+
accept_eula = true
52+
}
53+
}
54+
`, context)
55+
}
56+
57+
func TestAccVertexAIEndpointWithModelGardenDeployment_withConfigs(t *testing.T) {
58+
t.Parallel()
59+
60+
context := map[string]interface{}{
61+
"random_suffix": acctest.RandString(t, 10),
62+
}
63+
64+
acctest.VcrTest(t, resource.TestCase{
65+
PreCheck: func() { acctest.AccTestPreCheck(t) },
66+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
67+
CheckDestroy: nil,
68+
Steps: []resource.TestStep{
69+
{
70+
Config: testAccVertexAIEndpointWithModelGardenDeployment_withConfigs(context),
71+
},
72+
},
73+
})
74+
}
75+
76+
func testAccVertexAIEndpointWithModelGardenDeployment_withConfigs(context map[string]interface{}) string {
77+
return acctest.Nprintf(`
78+
resource "google_vertex_ai_endpoint_with_model_garden_deployment" "test_with_configs" {
79+
publisher_model_name = "publishers/google/models/paligemma@paligemma-224-float32"
80+
location = "us-central1"
81+
model_config {
82+
accept_eula = true
83+
}
84+
deploy_config {
85+
dedicated_resources {
86+
machine_spec {
87+
machine_type = "g2-standard-16"
88+
accelerator_type = "NVIDIA_L4"
89+
accelerator_count = 1
90+
}
91+
min_replica_count = 1
92+
}
93+
}
94+
}
95+
`, context)
96+
}

0 commit comments

Comments
 (0)