Signed-off-by: Modular Magician <magic-modules@google.com>
4.3 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
Google: google_firestore_index | docs-google-firestore-index | Cloud Firestore indexes enable simple and complex queries against documents in a database. |
google_firestore_index
Cloud Firestore indexes enable simple and complex queries against documents in a database. This resource manages composite indexes and not single field indexes.
To get more information about Index, see:
- API documentation
- How-to Guides
resource "google_firestore_index" "my-index" {
project = "my-project-name"
collection = "chatrooms"
fields {
field_path = "name"
order = "ASCENDING"
}
fields {
field_path = "description"
order = "DESCENDING"
}
fields {
field_path = "__name__"
order = "DESCENDING"
}
}
Argument Reference
The following arguments are supported:
-
collection
- (Required) The collection being indexed. -
fields
- (Required) The fields supported by this index. The last field entry is always for the field path__name__
. If, on creation,__name__
was not specified as the last field, it will be added automatically with the same direction as that of the last field defined. If the final field in a composite index is not directional, the__name__
will be ordered"ASCENDING"
(unless explicitly specified otherwise). Structure is documented below.
The fields
block supports:
-
field_path
- (Optional) Name of the field. -
order
- (Optional) Indicates that this field supports ordering by the specified order or comparing using =, <, <=, >, >=. Only one oforder
andarrayConfig
can be specified. -
array_config
- (Optional) Indicates that this field supports operations on arrayValues. Only one oforder
andarrayConfig
can be specified.
-
database
- (Optional) The Firestore database id. Defaults to"(default)"
. -
query_scope
- (Optional) The scope at which a query is run. Defaults to"COLLECTION"
. -
project
- (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
name
- A server defined name for this index. Format:projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}
Timeouts
This resource provides the following Timeouts configuration options:
create
- Default is 10 minutes.delete
- Default is 10 minutes.
Import
Index can be imported using any of these accepted formats:
$ terraform import google_firestore_index.default {{name}}
-> If you're importing a resource with beta features, make sure to include -provider=google-beta
as an argument so that Terraform uses the correct provider to import your resource.