Data Store Index Args
Warning:
datastore_index
is deprecated and will be removed in a future major release. Usefirestore_index
instead; this resource is deprecated because it only supports the (default) database.firestore_index
supports both Firestore in Datastore Mode and Firestore Native indexes and supports both named and the (default) database. Describes a composite index for Firestore in Datastore Mode. To get more information about Index, see:
How-to Guides
Warning:
datastore_index
is deprecated and will be removed in a future major release. Usefirestore_index
instead; this resource is deprecated because it only supports the (default) database. This resource creates a Datastore Index on a project that has already enabled a Datastore-compatible database. If you haven't already created it, you may create agcp.firestore.Database
resource withlocation_id
set to your chosen location, andtype
set to"DATASTORE_MODE"
. If you wish to use App Engine, you may instead create agcp.appengine.Application
resource withdatabase_type
set to"CLOUD_DATASTORE_COMPATIBILITY"
. Your Datastore location will be the same as the App Engine location specified.
Example Usage
Datastore Index
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "(default)",
locationId: "nam5",
type: "DATASTORE_MODE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const _default = new gcp.datastore.DataStoreIndex("default", {
kind: "foo",
properties: [
{
name: "property_a",
direction: "ASCENDING",
},
{
name: "property_b",
direction: "ASCENDING",
},
],
}, {
dependsOn: [database],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="(default)",
location_id="nam5",
type="DATASTORE_MODE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
default = gcp.datastore.DataStoreIndex("default",
kind="foo",
properties=[
{
"name": "property_a",
"direction": "ASCENDING",
},
{
"name": "property_b",
"direction": "ASCENDING",
},
],
opts = pulumi.ResourceOptions(depends_on=[database]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var database = new Gcp.Firestore.Database("database", new()
{
Project = "my-project-name",
Name = "(default)",
LocationId = "nam5",
Type = "DATASTORE_MODE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var @default = new Gcp.Datastore.DataStoreIndex("default", new()
{
Kind = "foo",
Properties = new[]
{
new Gcp.Datastore.Inputs.DataStoreIndexPropertyArgs
{
Name = "property_a",
Direction = "ASCENDING",
},
new Gcp.Datastore.Inputs.DataStoreIndexPropertyArgs
{
Name = "property_b",
Direction = "ASCENDING",
},
},
}, new CustomResourceOptions
{
DependsOn =
{
database,
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/datastore"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firestore"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
Project: pulumi.String("my-project-name"),
Name: pulumi.String("(default)"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("DATASTORE_MODE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = datastore.NewDataStoreIndex(ctx, "default", &datastore.DataStoreIndexArgs{
Kind: pulumi.String("foo"),
Properties: datastore.DataStoreIndexPropertyArray{
&datastore.DataStoreIndexPropertyArgs{
Name: pulumi.String("property_a"),
Direction: pulumi.String("ASCENDING"),
},
&datastore.DataStoreIndexPropertyArgs{
Name: pulumi.String("property_b"),
Direction: pulumi.String("ASCENDING"),
},
},
}, pulumi.DependsOn([]pulumi.Resource{
database,
}))
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.firestore.Database;
import com.pulumi.gcp.firestore.DatabaseArgs;
import com.pulumi.gcp.datastore.DataStoreIndex;
import com.pulumi.gcp.datastore.DataStoreIndexArgs;
import com.pulumi.gcp.datastore.inputs.DataStoreIndexPropertyArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var database = new Database("database", DatabaseArgs.builder()
.project("my-project-name")
.name("(default)")
.locationId("nam5")
.type("DATASTORE_MODE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var default_ = new DataStoreIndex("default", DataStoreIndexArgs.builder()
.kind("foo")
.properties(
DataStoreIndexPropertyArgs.builder()
.name("property_a")
.direction("ASCENDING")
.build(),
DataStoreIndexPropertyArgs.builder()
.name("property_b")
.direction("ASCENDING")
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(database)
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: (default)
locationId: nam5
type: DATASTORE_MODE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
default:
type: gcp:datastore:DataStoreIndex
properties:
kind: foo
properties:
- name: property_a
direction: ASCENDING
- name: property_b
direction: ASCENDING
options:
dependson:
- ${database}
Import
Index can be imported using any of these accepted formats:
projects/{{project}}/indexes/{{index_id}}
{{project}}/{{index_id}}
{{index_id}}
When using thepulumi import
command, Index can be imported using one of the formats above. For example:
$ pulumi import gcp:datastore/dataStoreIndex:DataStoreIndex default projects/{{project}}/indexes/{{index_id}}
$ pulumi import gcp:datastore/dataStoreIndex:DataStoreIndex default {{project}}/{{index_id}}
$ pulumi import gcp:datastore/dataStoreIndex:DataStoreIndex default {{index_id}}