FeatureView is representation of values that the FeatureOnlineStore will serve based on its syncConfig.
To get more information about FeatureOnlineStoreFeatureview, see:
resource "google_vertex_ai_feature_online_store" "featureonlinestore" {
name = "example_feature_view"
labels = {
foo = "bar"
}
region = "us-central1"
bigtable {
auto_scaling {
min_node_count = 1
max_node_count = 2
cpu_utilization_target = 80
}
}
}
resource "google_bigquery_dataset" "tf-test-dataset" {
dataset_id = "example_feature_view"
friendly_name = "test"
description = "This is a test description"
location = "US"
}
resource "google_bigquery_table" "tf-test-table" {
deletion_protection = false
dataset_id = google_bigquery_dataset.tf-test-dataset.dataset_id
table_id = "example_feature_view"
schema = <<EOF
[
{
"name": "entity_id",
"mode": "NULLABLE",
"type": "STRING",
"description": "Test default entity_id"
},
{
"name": "test_entity_column",
"mode": "NULLABLE",
"type": "STRING",
"description": "test secondary entity column"
},
{
"name": "feature_timestamp",
"mode": "NULLABLE",
"type": "TIMESTAMP",
"description": "Default timestamp value"
}
]
EOF
}
resource "google_vertex_ai_feature_online_store_featureview" "featureview" {
name = "example_feature_view"
region = "us-central1"
feature_online_store = google_vertex_ai_feature_online_store.featureonlinestore.name
sync_config {
cron = "0 0 * * *"
}
big_query_source {
uri = "bq://${google_bigquery_table.tf-test-table.project}.${google_bigquery_table.tf-test-table.dataset_id}.${google_bigquery_table.tf-test-table.table_id}"
entity_id_columns = ["test_entity_column"]
}
}
data "google_project" "project" {
provider = google
}
resource "google_vertex_ai_feature_online_store" "featureonlinestore" {
name = "example_feature_view_feature_registry"
labels = {
foo = "bar"
}
region = "us-central1"
bigtable {
auto_scaling {
min_node_count = 1
max_node_count = 2
cpu_utilization_target = 80
}
}
}
resource "google_bigquery_dataset" "sample_dataset" {
dataset_id = "example_feature_view_feature_registry"
friendly_name = "test"
description = "This is a test description"
location = "US"
}
resource "google_bigquery_table" "sample_table" {
deletion_protection = false
dataset_id = google_bigquery_dataset.sample_dataset.dataset_id
table_id = "example_feature_view_feature_registry"
schema = <<EOF
[
{
"name": "feature_id",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "example_feature_view_feature_registry",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "feature_timestamp",
"type": "TIMESTAMP",
"mode": "NULLABLE"
}
]
EOF
}
resource "google_vertex_ai_feature_group" "sample_feature_group" {
name = "example_feature_view_feature_registry"
description = "A sample feature group"
region = "us-central1"
labels = {
label-one = "value-one"
}
big_query {
big_query_source {
# The source table must have a column named 'feature_timestamp' of type TIMESTAMP.
input_uri = "bq://${google_bigquery_table.sample_table.project}.${google_bigquery_table.sample_table.dataset_id}.${google_bigquery_table.sample_table.table_id}"
}
entity_id_columns = ["feature_id"]
}
}
resource "google_vertex_ai_feature_group_feature" "sample_feature" {
name = "example_feature_view_feature_registry"
region = "us-central1"
feature_group = google_vertex_ai_feature_group.sample_feature_group.name
description = "A sample feature"
labels = {
label-one = "value-one"
}
}
resource "google_vertex_ai_feature_online_store_featureview" "featureview_featureregistry" {
name = "example_feature_view_feature_registry"
region = "us-central1"
feature_online_store = google_vertex_ai_feature_online_store.featureonlinestore.name
sync_config {
cron = "0 0 * * *"
}
feature_registry_source {
feature_groups {
feature_group_id = google_vertex_ai_feature_group.sample_feature_group.name
feature_ids = [google_vertex_ai_feature_group_feature.sample_feature.name]
}
}
}
resource "google_vertex_ai_feature_online_store" "featureonlinestore" {
provider = google-beta
name = "example_feature_view_vector_search"
labels = {
foo = "bar"
}
region = "us-central1"
bigtable {
auto_scaling {
min_node_count = 1
max_node_count = 2
cpu_utilization_target = 80
}
}
embedding_management {
enabled = true
}
}
resource "google_bigquery_dataset" "tf-test-dataset" {
provider = google-beta
dataset_id = "example_feature_view_vector_search"
friendly_name = "test"
description = "This is a test description"
location = "US"
}
resource "google_bigquery_table" "tf-test-table" {
provider = google-beta
deletion_protection = false
dataset_id = google_bigquery_dataset.tf-test-dataset.dataset_id
table_id = "example_feature_view_vector_search"
schema = <<EOF
[
{
"name": "test_primary_id",
"mode": "NULLABLE",
"type": "STRING",
"description": "primary test id"
},
{
"name": "embedding",
"mode": "REPEATED",
"type": "FLOAT",
"description": "embedding column for primary_id column"
},
{
"name": "country",
"mode": "NULLABLE",
"type": "STRING",
"description": "country"
},
{
"name": "test_crowding_column",
"mode": "NULLABLE",
"type": "INTEGER",
"description": "test crowding column"
},
{
"name": "entity_id",
"mode": "NULLABLE",
"type": "STRING",
"description": "Test default entity_id"
},
{
"name": "test_entity_column",
"mode": "NULLABLE",
"type": "STRING",
"description": "test secondary entity column"
},
{
"name": "feature_timestamp",
"mode": "NULLABLE",
"type": "TIMESTAMP",
"description": "Default timestamp value"
}
]
EOF
}
resource "google_vertex_ai_feature_online_store_featureview" "featureview_vector_search" {
provider = google-beta
name = "example_feature_view_vector_search"
region = "us-central1"
feature_online_store = google_vertex_ai_feature_online_store.featureonlinestore.name
sync_config {
cron = "0 0 * * *"
}
big_query_source {
uri = "bq://${google_bigquery_table.tf-test-table.project}.${google_bigquery_table.tf-test-table.dataset_id}.${google_bigquery_table.tf-test-table.table_id}"
entity_id_columns = ["test_entity_column"]
}
vector_search_config {
embedding_column = "embedding"
filter_columns = ["country"]
crowding_column = "test_crowding_column"
distance_measure_type = "DOT_PRODUCT_DISTANCE"
tree_ah_config {
leaf_node_embedding_count = "1000"
}
embedding_dimension = "2"
}
}
data "google_project" "project" {
provider = google-beta
}
The following arguments are supported:
feature_online_store
-
(Required)
The name of the FeatureOnlineStore to use for the featureview.
region
-
(Required)
The region for the resource. It should be the same as the featureonlinestore region.
name
-
(Optional)
Name of the FeatureView. This value may be up to 60 characters, and valid characters are [a-z0-9_]. The first character cannot be a number.
labels
-
(Optional)
A set of key/value label pairs to assign to this FeatureView.
Note: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field effective_labels
for all of the labels present on the resource.
sync_config
-
(Optional)
Configures when data is to be synced/updated for this FeatureView. At the end of the sync the latest featureValues for each entityId of this FeatureView are made ready for online serving.
Structure is documented below.
big_query_source
-
(Optional)
Configures how data is supposed to be extracted from a BigQuery source to be loaded onto the FeatureOnlineStore.
Structure is documented below.
feature_registry_source
-
(Optional)
Configures the features from a Feature Registry source that need to be loaded onto the FeatureOnlineStore.
Structure is documented below.
vector_search_config
-
(Optional, Beta)
Configuration for vector search. It contains the required configurations to create an index from source data, so that approximate nearest neighbor (a.k.a ANN) algorithms search can be performed during online serving.
Structure is documented below.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
The sync_config
block supports:
cron
-
(Optional)
Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled runs.
To explicitly set a timezone to the cron tab, apply a prefix in the cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".The big_query_source
block supports:
uri
-
(Required)
The BigQuery view URI that will be materialized on each sync trigger based on FeatureView.SyncConfig.
entity_id_columns
-
(Required)
Columns to construct entityId / row keys. Start by supporting 1 only.
The feature_registry_source
block supports:
feature_groups
-
(Required)
List of features that need to be synced to Online Store.
Structure is documented below.The feature_groups
block supports:
feature_group_id
-
(Required)
Identifier of the feature group.
feature_ids
-
(Required)
Identifiers of features under the feature group.
The vector_search_config
block supports:
embedding_column
-
(Required)
Column of embedding. This column contains the source data to create index for vector search.
filter_columns
-
(Optional)
Columns of features that are used to filter vector search results.
crowding_column
-
(Optional)
Column of crowding. This column contains crowding attribute which is a constraint on a neighbor list produced by nearest neighbor search requiring that no more than some value k' of the k neighbors returned have the same value of crowdingAttribute.
distance_measure_type
-
(Optional)
The distance measure used in nearest neighbor search.
For details on allowed values, see the API documentation.
Possible values are: SQUARED_L2_DISTANCE
, COSINE_DISTANCE
, DOT_PRODUCT_DISTANCE
.
tree_ah_config
-
(Optional)
Configuration options for the tree-AH algorithm (Shallow tree + Asymmetric Hashing). Please refer to this paper for more details: https://arxiv.org/abs/1908.10396
Structure is documented below.
brute_force_config
-
(Optional)
Configuration options for using brute force search, which simply implements the standard linear search in the database for each query. It is primarily meant for benchmarking and to generate the ground truth for approximate search.
embedding_dimension
-
(Optional)
The number of dimensions of the input embedding.
The tree_ah_config
block supports:
leaf_node_embedding_count
-
(Optional)
Number of embeddings on each leaf node. The default value is 1000 if not set.In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/{{region}}/featureOnlineStores/{{feature_online_store}}/featureViews/{{name}}
create_time
-
The timestamp of when the featureOnlinestore was created in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
update_time
-
The timestamp of when the featureOnlinestore was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
terraform_labels
-
The combination of labels configured directly on the resource
and default labels configured on the provider.
effective_labels
-
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.FeatureOnlineStoreFeatureview can be imported using any of these accepted formats:
projects/{{project}}/locations/{{region}}/featureOnlineStores/{{feature_online_store}}/featureViews/{{name}}
{{project}}/{{region}}/{{feature_online_store}}/{{name}}
{{region}}/{{feature_online_store}}/{{name}}
{{feature_online_store}}/{{name}}
In Terraform v1.5.0 and later, use an import
block to import FeatureOnlineStoreFeatureview using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{region}}/featureOnlineStores/{{feature_online_store}}/featureViews/{{name}}"
to = google_vertex_ai_feature_online_store_featureview.default
}
When using the terraform import
command, FeatureOnlineStoreFeatureview can be imported using one of the formats above. For example:
$ terraform import google_vertex_ai_feature_online_store_featureview.default projects/{{project}}/locations/{{region}}/featureOnlineStores/{{feature_online_store}}/featureViews/{{name}}
$ terraform import google_vertex_ai_feature_online_store_featureview.default {{project}}/{{region}}/{{feature_online_store}}/{{name}}
$ terraform import google_vertex_ai_feature_online_store_featureview.default {{region}}/{{feature_online_store}}/{{name}}
$ terraform import google_vertex_ai_feature_online_store_featureview.default {{feature_online_store}}/{{name}}
This resource supports User Project Overrides.