Skip to content

Commit 30bd951

Browse files
vertexai: add psc_automation_configs to resource google_vertex_ai_index_endpoint (#15636)
1 parent 05d7498 commit 30bd951

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

mmv1/products/vertexai/IndexEndpoint.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,20 @@ properties:
131131
immutable: true
132132
item_type:
133133
type: String
134+
- name: 'pscAutomationConfigs'
135+
type: Array
136+
description: List of projects and networks where the PSC endpoints will be created. This field is used by Online Inference(Prediction) only.
137+
item_type:
138+
type: NestedObject
139+
properties:
140+
- name: 'projectId'
141+
type: String
142+
required: true
143+
description: Project id used to create forwarding rule.
144+
- name: 'network'
145+
type: String
146+
required: true
147+
description: 'The full name of the Google Compute Engine [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). [Format](https://cloud.google.com/compute/docs/reference/rest/v1/networks/get): projects/{project}/global/networks/{network}.'
134148
- name: 'publicEndpointEnabled'
135149
type: Boolean
136150
description: If true, the deployed index will be accessible through public endpoint.

mmv1/templates/terraform/custom_flatten/vertex_ai_index_endpoint_private_service_connect_config.go.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.Reso
2828
flattenVertexAIIndexEndpointPrivateServiceConnectConfigEnablePrivateServiceConnect(original["enablePrivateServiceConnect"], d, config)
2929
transformed["project_allowlist"] =
3030
flattenVertexAIIndexEndpointPrivateServiceConnectConfigProjectAllowlist(original["projectAllowlist"], d, config)
31+
transformed["psc_automation_configs"] = d.Get("private_service_connect_config.0.psc_automation_configs")
3132
return []interface{}{transformed}
3233
}
3334

mmv1/third_party/terraform/services/vertexai/resource_vertex_ai_index_endpoint_test.go

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,31 @@ func TestAccVertexAIIndexEndpoint_updated(t *testing.T) {
4444
})
4545
}
4646

47+
func TestAccVertexAIIndexEndpoint_psc_automation_config(t *testing.T) {
48+
t.Parallel()
49+
50+
context := map[string]interface{}{
51+
"random_suffix": acctest.RandString(t, 10),
52+
}
53+
54+
acctest.VcrTest(t, resource.TestCase{
55+
PreCheck: func() { acctest.AccTestPreCheck(t) },
56+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
57+
CheckDestroy: testAccCheckVertexAIIndexEndpointDestroyProducer(t),
58+
Steps: []resource.TestStep{
59+
{
60+
Config: testAccVertexAIIndexEndpoint_psc_automation_config(context),
61+
},
62+
{
63+
ResourceName: "google_vertex_ai_index_endpoint.index_endpoint",
64+
ImportState: true,
65+
ImportStateVerify: true,
66+
ImportStateVerifyIgnore: []string{"etag", "region", "labels", "terraform_labels", "private_service_connect_config.0.psc_automation_configs"},
67+
},
68+
},
69+
})
70+
}
71+
4772
func testAccVertexAIIndexEndpoint_basic(context map[string]interface{}) string {
4873
return acctest.Nprintf(`
4974
resource "google_vertex_ai_index_endpoint" "index_endpoint" {
@@ -89,3 +114,43 @@ data "google_compute_network" "vertex_network" {
89114
data "google_project" "project" {}
90115
`, context)
91116
}
117+
118+
func testAccVertexAIIndexEndpoint_psc_automation_config(context map[string]interface{}) string {
119+
return acctest.Nprintf(`
120+
resource "google_vertex_ai_index_endpoint" "index_endpoint" {
121+
display_name = "tf-test-sample-endpoint-%{random_suffix}"
122+
description = "A sample vertex endpoint"
123+
region = "us-central1"
124+
125+
labels = {
126+
label-one = "value-one"
127+
}
128+
129+
private_service_connect_config {
130+
enable_private_service_connect = true
131+
project_allowlist = [
132+
data.google_project.project.name,
133+
]
134+
135+
psc_automation_configs {
136+
project_id = data.google_project.project.id
137+
network = google_compute_network.network.id
138+
}
139+
}
140+
}
141+
142+
resource "google_compute_subnetwork" "subnetwork" {
143+
name = "tf-test-subnetwork-%{random_suffix}"
144+
ip_cidr_range = "192.168.0.0/24"
145+
region = "us-central1"
146+
network = google_compute_network.network.id
147+
}
148+
149+
resource "google_compute_network" "network" {
150+
name = "tf-test-network-%{random_suffix}"
151+
auto_create_subnetworks = false
152+
}
153+
154+
data "google_project" "project" {}
155+
`, context)
156+
}

0 commit comments

Comments
 (0)