firestore library
Cloud Firestore — Native and Datastore mode databases + composite index management.
Classes
- BackupRecurrence
-
Choice of recurrence for a GoogleFirestoreBackupSchedule. Sealed so
the dichotomy is exhaustive at the type level. The Firestore service
requires exactly one of
daily_recurrence/weekly_recurrence-- the schema marks both as independently optional but rejects schedules with neither or both. - CmekConfig
-
cmek_configblock (single, max_items=1). Wraps the database in Customer-Managed Encryption. Setting this on an existing database forces replacement -- CMEK cannot be added or removed in place. - DailyRecurrence
-
daily_recurrenceblock. Carries no fields -- its presence alone signals "run every day". The encoded value is a single empty map (matching the schema'smax_items: 1, listshape). - GoogleFirestoreBackupSchedule
-
Factory wrapper for
google_firestore_backup_schedule. - GoogleFirestoreDatabase
-
Factory wrapper for
google_firestore_database(providerhashicorp/google ~> 7.0). - GoogleFirestoreField
-
Factory wrapper for
google_firestore_field. - GoogleFirestoreIndex
-
Factory wrapper for
google_firestore_index(providerhashicorp/google ~> 7.0). - GoogleFirestoreUserCreds
-
Factory wrapper for
google_firestore_user_creds. - IndexConfig
-
index_configblock (max_items=1). Overrides Firestore's automatic single-field indexing for the parent field. An empty indexes list disables all single-field indexes on the field; a populated list adds explicit per-field indexes (mix of ordered / array-contains). - IndexField
-
One entry in
fields[]. Each indexed field declares either an IndexFieldOrder (range queries / equality / ORDER BY) or an IndexFieldArrayConfig (array-contains queries) via spec. The schema's commented exactly_one_of constraint overorder/array_config/search_config/vector_configis modeled at the type level by the sealed IndexFieldSpec dispatch. - IndexFieldArrayConfig
-
Array-contains dimension for a field. Firestore only supports
'CONTAINS'as the array config today, so no parameter is exposed. - IndexFieldOrder
- Range / equality / order-by dimension for a field. Pair FirestoreIndexOrder.descending to flip the per-field direction.
- IndexFieldSearchConfig
-
Text-search dimension for a field (Firestore Vector Search /
full-text search). The schema models this as a nested block with
geo_spec+text_spec; onlytext_specis exposed here becausegeo_specrequires a single boolean knob and merits a separate variant if/when needed. - IndexFieldSpec
-
Sealed dispatch for IndexField.spec. Models the schema's
exactly_one_of (
order/array_config/search_config/vector_config) at the type level. Subclasses encode their own Terraform key. - IndexFieldTextSpec
-
search_config.text_specblock. Carries a list of IndexFieldTextSpecEntry entries (one per index_spec the user wants to configure -- e.g. one for substring matching, one for prefix matching of the same field). - IndexFieldTextSpecEntry
-
One entry in
text_spec.index_specs. Both fields are schema-optional; combinations are documented in https://firebase.google.com/docs/firestore/text-search. - IndexFieldVectorConfig
-
Vector-search dimension for a field. The schema requires
dimension plus a marker
flatsub-block; the wrapper emits both. - SingleFieldIndex
-
One entry in
index_config.indexes. Pick exactly one of order (ranged / equality / ORDER BY) or arrayContains (array-contains queries) -- the schema marks them mutually exclusive ("Only one of 'order' and 'arrayConfig' can be specified"). queryScope is independent and defaults toCOLLECTIONserver-side. - TtlConfig
-
ttl_configblock (max_items=1). Presence alone enables the TTL policy on the parent field -- the schema's single attribute (state) is computed and read-only. Passconst TtlConfig()to enable; omit to disable. - WeeklyRecurrence
-
weekly_recurrenceblock. Optional day specifies which weekday the backup runs on; when null, the provider defaults to the schema'sDAY_OF_WEEK_UNSPECIFIED(server picks). Pin a specific day for predictable backup windows.
Enums
- AppEngineIntegrationMode
-
app_engine_integration_mode-- whether the database participates in the legacy App Engine integration. Only meaningful for Datastore-mode databases that were originally provisioned via App Engine. - BackupDayOfWeek
-
weekly_recurrence.day-- which day of the week the weekly backup runs on.dayOfWeekUnspecifiedis the schema-default sentinel (server picks the day); the seven concrete weekdays pin the slot. - ConcurrencyMode
-
concurrency_mode-- transaction concurrency strategy.optimisticis the default for Native mode;pessimisticis the default for Datastore mode.optimisticWithEntityGroupsis a legacy Datastore-mode option. - DatabaseEdition
-
database_edition-- pricing + feature tier.enterpriseunlocks the MongoDB-compatible / Realtime-Updates / Data-Access modes but forcestypeto befirestoreNative. - DeleteProtectionState
-
delete_protection_state-- whenenabled, the database refuses delete operations until protection is disabled. Defaultunspecified(server-side equivalent todisabled). - FirestoreDataAccessMode
-
firestore_data_access_mode-- whether the Firestore document API is accessible. Only valid forenterpriseedition. Use to lock down a database to MongoDB-compatible / Realtime-Updates access only. - FirestoreDatabaseType
-
type-- choose between Cloud Firestore's two API modes. Forces replacement when changed. - FirestoreFieldOrder
-
One SingleFieldIndex.order direction.
ASCENDING/DESCENDING. - FirestoreFieldQueryScope
-
query_scope-- which queries can use this single-field index.collectionscopes the index to a single collection;collectionGroupallows the index to serve collection-group queries. - FirestoreIndexApiScope
-
api_scope-- which Firestore API surface the index targets.anyApi(the default) serves both the Firestore native API and the Datastore-mode API; the others restrict to one. - FirestoreIndexDeletionPolicy
-
deletion_policy-- behaviour onterraform destroy.delete(the default) tears the index down both in state and in GCP.preventkeeps the index in GCP and FAILS the destroy -- a safety mode for indexes that back production queries. - FirestoreIndexDensity
-
density-- whether the index includes documents that are missing the indexed fields.sparseAllonly indexes documents with values for ALL fields (the default for composite indexes);sparseAnyindexes documents with ANY field;denseindexes every document. - FirestoreIndexOrder
- One IndexField.spec dimension. Pairs with FirestoreIndexOrder.descending to flip the per-field index direction.
- FirestoreIndexQueryScope
-
query_scope-- which queries can use this index.collection(the default) limits the index to queries scoped to a single collection;collectionGroupallows collection-group queries;collectionRecursivealso covers descendant collection groups. - MongodbCompatibleDataAccessMode
-
mongodb_compatible_data_access_mode-- whether the MongoDB-compatible API is accessible. Only valid forenterpriseedition. - PointInTimeRecoveryEnablement
-
point_in_time_recovery_enablement-- whenenabled, reads can target timestamps within the past 7 days (1-minute granularity beyond the most-recent hour). Defaultdisabled. - RealtimeUpdatesMode
-
realtime_updates_mode-- whether the WebSocket-based realtime listener API is accessible. Only valid forenterpriseedition.