Skip to content

Commit 8256b8e

Browse files
piyush123gomu18
andauthored
Vertexai feature online store bigtable (#15963)
Co-authored-by: gomu18 <[email protected]>
1 parent 87ac068 commit 8256b8e

File tree

3 files changed

+114
-2
lines changed

3 files changed

+114
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ tpgtools/serialization.go
6565
/.ijwb/
6666
MODULE.bazel.lock
6767
go.work
68-
go.work.sum
68+
go.work.sum
69+
terraform-provider-google/

mmv1/products/vertexai/FeatureOnlineStore.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ properties:
119119
- 'bigtable'
120120
- 'optimized'
121121
properties:
122+
- name: 'enableDirectBigtableAccess'
123+
type: Boolean
124+
description: 'Optional. If true, enable direct access to the Bigtable instance.'
122125
- name: 'autoScaling'
123126
type: NestedObject
124127
description: Autoscaling config applied to Bigtable Instance.
@@ -139,6 +142,10 @@ properties:
139142
When a cluster's CPU utilization exceeds the target that you have set,
140143
Bigtable immediately adds nodes to the cluster. When CPU utilization is substantially lower than the target, Bigtable removes nodes. If not set will default to 50%.
141144
default_from_api: true
145+
- name: 'zone'
146+
type: String
147+
description: The zone where the Bigtable instance will be created.
148+
default_from_api: true
142149
- name: 'optimized'
143150
type: NestedObject
144151
description:
@@ -152,7 +159,7 @@ properties:
152159
- 'bigtable'
153160
- 'optimized'
154161
properties:
155-
# Meant to be an empty object with no properties - see here : https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/projects.locations.featureOnlineStores#Optimized
162+
# Meant to be an empty object with no properties - see here : https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/projects.locations.featureOnlineStores#Optimized
156163
[]
157164
- name: 'dedicatedServingEndpoint'
158165
type: NestedObject
@@ -201,3 +208,13 @@ properties:
201208
description: |
202209
Enable embedding management.
203210
immutable: true
211+
- name: 'encryptionSpec'
212+
type: NestedObject
213+
description: |
214+
If set, both of the online and offline data storage will be secured by this key.
215+
properties:
216+
- name: 'kmsKeyName'
217+
type: String
218+
description: |
219+
The Cloud KMS resource identifier of the customer managed encryption key used to protect a resource. Has the form: projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key. The key needs to be in the same region as where the compute resource is created.
220+
required: true

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

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,97 @@ resource google_vertex_ai_feature_online_store "feature_online_store" {
8383
}
8484
`, context)
8585
}
86+
87+
func TestAccVertexAIFeatureOnlineStore_bigtable_full(t *testing.T) {
88+
t.Parallel()
89+
90+
kms := acctest.BootstrapKMSKeyInLocation(t, "us-central1")
91+
92+
context := map[string]interface{}{
93+
"random_suffix": acctest.RandString(t, 10),
94+
"kms_key_name": kms.CryptoKey.Name,
95+
}
96+
97+
acctest.VcrTest(t, resource.TestCase{
98+
PreCheck: func() { acctest.AccTestPreCheck(t) },
99+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
100+
CheckDestroy: testAccCheckVertexAIFeatureOnlineStoreDestroyProducer(t),
101+
Steps: []resource.TestStep{
102+
{
103+
Config: testAccVertexAIFeatureOnlineStore_bigtable_full(context),
104+
},
105+
{
106+
ResourceName: "google_vertex_ai_feature_online_store.feature_online_store",
107+
ImportState: true,
108+
ImportStateVerify: true,
109+
ImportStateVerifyIgnore: []string{"name", "etag", "region", "force_destroy", "labels", "terraform_labels"},
110+
},
111+
},
112+
})
113+
}
114+
115+
func testAccVertexAIFeatureOnlineStore_bigtable_full(context map[string]interface{}) string {
116+
return acctest.Nprintf(`
117+
resource google_vertex_ai_feature_online_store "feature_online_store" {
118+
name = "tf_test_feature_online_store%{random_suffix}"
119+
region = "us-central1"
120+
121+
bigtable {
122+
auto_scaling {
123+
min_node_count = 1
124+
max_node_count = 2
125+
}
126+
enable_direct_bigtable_access = true
127+
zone = "us-central1-a"
128+
}
129+
encryption_spec {
130+
kms_key_name = "%{kms_key_name}"
131+
}
132+
force_destroy = true
133+
}
134+
`, context)
135+
}
136+
137+
func TestAccVertexAIFeatureOnlineStore_bigtable_with_zone(t *testing.T) {
138+
t.Parallel()
139+
140+
context := map[string]interface{}{
141+
"random_suffix": acctest.RandString(t, 10),
142+
}
143+
144+
acctest.VcrTest(t, resource.TestCase{
145+
PreCheck: func() { acctest.AccTestPreCheck(t) },
146+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
147+
CheckDestroy: testAccCheckVertexAIFeatureOnlineStoreDestroyProducer(t),
148+
Steps: []resource.TestStep{
149+
{
150+
Config: testAccVertexAIFeatureOnlineStore_bigtable_with_zone(context),
151+
},
152+
{
153+
ResourceName: "google_vertex_ai_feature_online_store.feature_online_store",
154+
ImportState: true,
155+
ImportStateVerify: true,
156+
ImportStateVerifyIgnore: []string{"name", "etag", "region", "force_destroy", "labels", "terraform_labels"},
157+
},
158+
},
159+
})
160+
}
161+
162+
func testAccVertexAIFeatureOnlineStore_bigtable_with_zone(context map[string]interface{}) string {
163+
return acctest.Nprintf(`
164+
resource google_vertex_ai_feature_online_store "feature_online_store" {
165+
name = "tf_test_feature_online_store%{random_suffix}"
166+
region = "us-central1"
167+
168+
bigtable {
169+
auto_scaling {
170+
min_node_count = 1
171+
max_node_count = 2
172+
cpu_utilization_target = 60
173+
}
174+
zone = "us-central1-a"
175+
}
176+
force_destroy = true
177+
}
178+
`, context)
179+
}

0 commit comments

Comments
 (0)