You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With this Terraform provider, you can create a collection with an auto schema fairly easily, using something like the code below
resource "typesense_collection" "test_collection" {
name = "test_collection"
fields {
name = ".*"
type = "auto"
optional = true
}
}
This will create fine. However, once you start populating documents into Typesense, the schema will add fields. When this happens, future Terraform applies will result in the new fields being called out as needing to be removed, and the whole collection will be replaced. This causes all documents to get deleted. Example, where the new documents had a single location field that was added to the schema:
# typesense_collection.test_collection must be replaced
-/+ resource "typesense_collection" "test_collection" {
~ id = "test_collection" -> (known after apply)
name = "test_collection"
~ num_documents = 14 -> (known after apply)
~ fields {
~ facet = false -> (known after apply)
index = true
name = ".*"
optional = true
type = "auto"
}
- fields {
- facet = false -> null
- index = true -> null
- name = "location" -> null
- optional = true -> null
- type = "string" -> null # forces replacement
}
I noticed this because I was creating the collection with the auto schema, and then creating the typesense_sync document that backfilled the data. On the next apply, which should have had no changes, it indicated my collection would need to be replaced. The backfill will then not occur again until you update or replace the sync document, in which case the process starts over.
Is there a way to do this so that auto schema will work with this Terraform provider? Or will only a pre-defined schema work as expected?
The text was updated successfully, but these errors were encountered:
Typesense allows you to use an auto-detected schema (see https://typesense.org/docs/0.22.2/api/collections.html#with-auto-schema-detection)
With this Terraform provider, you can create a collection with an auto schema fairly easily, using something like the code below
This will create fine. However, once you start populating documents into Typesense, the schema will add fields. When this happens, future Terraform applies will result in the new fields being called out as needing to be removed, and the whole collection will be replaced. This causes all documents to get deleted. Example, where the new documents had a single
location
field that was added to the schema:I noticed this because I was creating the collection with the auto schema, and then creating the
typesense_sync
document that backfilled the data. On the next apply, which should have had no changes, it indicated my collection would need to be replaced. The backfill will then not occur again until you update or replace the sync document, in which case the process starts over.Is there a way to do this so that auto schema will work with this Terraform provider? Or will only a pre-defined schema work as expected?
The text was updated successfully, but these errors were encountered: