File tree Expand file tree Collapse file tree
templates/terraform/examples Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ examples:
2626 primary_resource_id : " example-collection"
2727 vars :
2828 collection_id : " example-collection"
29+ - name : vectorsearch_collection_cmek
30+ primary_resource_id : " example-cmek-collection"
31+ vars :
32+ collection_id : " example-cmek-collection"
2933autogen_async : true
3034async :
3135 operation :
@@ -81,6 +85,23 @@ properties:
8185 - name : displayName
8286 type : String
8387 description : User-specified display name of the collection
88+ - name : encryptionSpec
89+ type : NestedObject
90+ description : |-
91+ Represents a customer-managed encryption key specification that can be
92+ applied to a Vector Search collection.
93+ immutable : true
94+ properties :
95+ - name : cryptoKeyName
96+ type : String
97+ required : true
98+ immutable : true
99+ description : |-
100+ Resource name of the Cloud KMS key used to protect the resource.
101+
102+ The Cloud KMS key must be in the same region as the resource. It must have
103+ the format
104+ `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
84105 - name : labels
85106 type : KeyValueLabels
86107 description : Labels as key value pairs.
Original file line number Diff line number Diff line change 1+ resource " google_vector_search_collection" " {{$.PrimaryResourceId}}" {
2+ location = " us-central1"
3+ collection_id = " {{index $.Vars " collection_id" }}"
4+
5+ display_name = " My Awesome Encrypted Collection"
6+ description = " This collection stores important data."
7+
8+ encryption_spec {
9+ crypto_key_name = google_kms_crypto_key.crypto_key.id
10+ }
11+
12+ labels = {
13+ env = " dev"
14+ team = " my-team"
15+ }
16+
17+ data_schema = <<EOF
18+ {
19+ " type" : " object" ,
20+ " properties" : {
21+ " title" : {
22+ " type" : " string"
23+ },
24+ " plot" : {
25+ " type" : " string"
26+ }
27+ }
28+ }
29+ EOF
30+
31+ vector_schema {
32+ field_name = " text_embedding"
33+ dense_vector {
34+ dimensions = 768
35+ vertex_embedding_config {
36+ model_id = " textembedding-gecko@003"
37+ task_type = " RETRIEVAL_DOCUMENT"
38+ text_template = " Title: {title} ---- Plot: {plot}"
39+ }
40+ }
41+ }
42+
43+ depends_on = [google_kms_crypto_key_iam_member.crypto_key_member_vs_sa ]
44+ }
45+
46+ resource " google_kms_crypto_key" " crypto_key" {
47+ name = " {{index $.Vars " collection_id" }}"
48+ key_ring = google_kms_key_ring.key_ring.id
49+ }
50+
51+ resource " google_kms_key_ring" " key_ring" {
52+ name = " {{index $.Vars " collection_id" }}"
53+ location = " us-central1"
54+ }
55+
56+ resource " google_kms_crypto_key_iam_member" " crypto_key_member_vs_sa" {
57+ crypto_key_id = google_kms_crypto_key.crypto_key.id
58+ role = " roles/cloudkms.cryptoKeyEncrypterDecrypter"
59+
60+ member = " serviceAccount:service-${data.google_project.project.number}@gcp-sa-vectorsearch.iam.gserviceaccount.com"
61+ }
62+
63+ data " google_project" " project" {}
64+
You can’t perform that action at this time.
0 commit comments