Describes a composite index for Cloud Datastore.
To get more information about Index, see:
resource "google_firestore_database" "database" {
project = "my-project-name"
# google_datastore_index resources only support the (default) database.
# However, google_firestore_index can express any Datastore Mode index
# and should be preferred in all cases.
name = "(default)"
location_id = "nam5"
type = "DATASTORE_MODE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "google_datastore_index" "default" {
kind = "foo"
properties {
name = "property_a"
direction = "ASCENDING"
}
properties {
name = "property_b"
direction = "ASCENDING"
}
depends_on = [google_firestore_database.database]
}
The following arguments are supported:
kind
-
(Required)
The entity kind which the index applies to.ancestor
-
(Optional)
Policy for including ancestors in the index.
Default value is NONE
.
Possible values are: NONE
, ALL_ANCESTORS
.
properties
-
(Optional)
An ordered list of properties to index on.
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 properties
block supports:
name
-
(Required)
The property name to index.
direction
-
(Required)
The direction the index should optimize for sorting.
Possible values are: ASCENDING
, DESCENDING
.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/indexes/{{index_id}}
index_id
-
The index id.
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.delete
- Default is 20 minutes.Index can be imported using any of these accepted formats:
projects/{{project}}/indexes/{{index_id}}
{{project}}/{{index_id}}
{{index_id}}
In Terraform v1.5.0 and later, use an import
block to import Index using one of the formats above. For example:
import {
id = "projects/{{project}}/indexes/{{index_id}}"
to = google_datastore_index.default
}
When using the terraform import
command, Index can be imported using one of the formats above. For example:
$ terraform import google_datastore_index.default projects/{{project}}/indexes/{{index_id}}
$ terraform import google_datastore_index.default {{project}}/{{index_id}}
$ terraform import google_datastore_index.default {{index_id}}
This resource supports User Project Overrides.