Index class
Cloud Firestore indexes enable simple and complex queries against documents in a database.
Firestore Native, Firestore with MongoDB compatibility and Datastore Mode indexes are all supported.
In Enterprise edition databases, this resource manages both single field and composite indexes.
In Standard edition databases, single field indexes are managed using the gcp.firestore.Field resource instead.
To get more information about Index, see:
- API documentation
- How-to Guides
- Official Documentation
> Warning: This resource creates a Firestore Index on a project that already has
a Firestore database. If you haven't already created it, you may
create a gcp.firestore.Database resource and locationId set
to your chosen location. If you wish to use App Engine, you may
instead create a gcp.appengine.Application resource.
Your Firestore location will be the same as the App Engine location specified.
Example Usage
Firestore Index Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "database-id",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
fields: [
{
fieldPath: "name",
order: "ASCENDING",
},
{
fieldPath: "description",
order: "DESCENDING",
},
],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="database-id",
location_id="nam5",
type="FIRESTORE_NATIVE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
fields=[
{
"field_path": "name",
"order": "ASCENDING",
},
{
"field_path": "description",
"order": "DESCENDING",
},
])
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 = "database-id",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "name",
Order = "ASCENDING",
},
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "description",
Order = "DESCENDING",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("database-id"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("name"),
Order: pulumi.String("ASCENDING"),
},
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("description"),
Order: pulumi.String("DESCENDING"),
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "database-id"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
fields {
field_path = "name"
order = "ASCENDING"
}
fields {
field_path = "description"
order = "DESCENDING"
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("database-id")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.fields(
IndexFieldArgs.builder()
.fieldPath("name")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("description")
.order("DESCENDING")
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id
locationId: nam5
type: FIRESTORE_NATIVE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
fields:
- fieldPath: name
order: ASCENDING
- fieldPath: description
order: DESCENDING
Firestore Index Datastore Mode
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "database-id-dm",
locationId: "nam5",
type: "DATASTORE_MODE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
queryScope: "COLLECTION_RECURSIVE",
apiScope: "DATASTORE_MODE_API",
density: "SPARSE_ALL",
fields: [
{
fieldPath: "name",
order: "ASCENDING",
},
{
fieldPath: "description",
order: "DESCENDING",
},
],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="database-id-dm",
location_id="nam5",
type="DATASTORE_MODE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
query_scope="COLLECTION_RECURSIVE",
api_scope="DATASTORE_MODE_API",
density="SPARSE_ALL",
fields=[
{
"field_path": "name",
"order": "ASCENDING",
},
{
"field_path": "description",
"order": "DESCENDING",
},
])
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 = "database-id-dm",
LocationId = "nam5",
Type = "DATASTORE_MODE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
QueryScope = "COLLECTION_RECURSIVE",
ApiScope = "DATASTORE_MODE_API",
Density = "SPARSE_ALL",
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "name",
Order = "ASCENDING",
},
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "description",
Order = "DESCENDING",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("database-id-dm"),
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 = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
QueryScope: pulumi.String("COLLECTION_RECURSIVE"),
ApiScope: pulumi.String("DATASTORE_MODE_API"),
Density: pulumi.String("SPARSE_ALL"),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("name"),
Order: pulumi.String("ASCENDING"),
},
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("description"),
Order: pulumi.String("DESCENDING"),
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "database-id-dm"
location_id = "nam5"
type = "DATASTORE_MODE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
query_scope = "COLLECTION_RECURSIVE"
api_scope = "DATASTORE_MODE_API"
density = "SPARSE_ALL"
fields {
field_path = "name"
order = "ASCENDING"
}
fields {
field_path = "description"
order = "DESCENDING"
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("database-id-dm")
.locationId("nam5")
.type("DATASTORE_MODE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.queryScope("COLLECTION_RECURSIVE")
.apiScope("DATASTORE_MODE_API")
.density("SPARSE_ALL")
.fields(
IndexFieldArgs.builder()
.fieldPath("name")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("description")
.order("DESCENDING")
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id-dm
locationId: nam5
type: DATASTORE_MODE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
queryScope: COLLECTION_RECURSIVE
apiScope: DATASTORE_MODE_API
density: SPARSE_ALL
fields:
- fieldPath: name
order: ASCENDING
- fieldPath: description
order: DESCENDING
Firestore Index Vector
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "database-id-vector",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
fields: [
{
fieldPath: "field_name",
order: "ASCENDING",
},
{
fieldPath: "__name__",
order: "ASCENDING",
},
{
fieldPath: "description",
vectorConfig: {
dimension: 128,
flat: {},
},
},
],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="database-id-vector",
location_id="nam5",
type="FIRESTORE_NATIVE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
fields=[
{
"field_path": "field_name",
"order": "ASCENDING",
},
{
"field_path": "__name__",
"order": "ASCENDING",
},
{
"field_path": "description",
"vector_config": {
"dimension": 128,
"flat": {},
},
},
])
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 = "database-id-vector",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "field_name",
Order = "ASCENDING",
},
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "__name__",
Order = "ASCENDING",
},
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "description",
VectorConfig = new Gcp.Firestore.Inputs.IndexFieldVectorConfigArgs
{
Dimension = 128,
Flat = null,
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("database-id-vector"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("field_name"),
Order: pulumi.String("ASCENDING"),
},
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("__name__"),
Order: pulumi.String("ASCENDING"),
},
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("description"),
VectorConfig: &firestore.IndexFieldVectorConfigArgs{
Dimension: pulumi.Int(128),
Flat: &firestore.IndexFieldVectorConfigFlatArgs{},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "database-id-vector"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
fields {
field_path = "field_name"
order = "ASCENDING"
}
fields {
field_path = "__name__"
order = "ASCENDING"
}
fields {
field_path = "description"
vector_config = {
dimension = 128
flat = {}
}
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldVectorConfigArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldVectorConfigFlatArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("database-id-vector")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.fields(
IndexFieldArgs.builder()
.fieldPath("field_name")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("__name__")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("description")
.vectorConfig(IndexFieldVectorConfigArgs.builder()
.dimension(128)
.flat(IndexFieldVectorConfigFlatArgs.builder()
.build())
.build())
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id-vector
locationId: nam5
type: FIRESTORE_NATIVE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
fields:
- fieldPath: field_name
order: ASCENDING
- fieldPath: __name__
order: ASCENDING
- fieldPath: description
vectorConfig:
dimension: 128
flat: {}
Firestore Index Name Descending
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "database-id",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
fields: [{
fieldPath: "__name__",
order: "DESCENDING",
}],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="database-id",
location_id="nam5",
type="FIRESTORE_NATIVE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
fields=[{
"field_path": "__name__",
"order": "DESCENDING",
}])
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 = "database-id",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "__name__",
Order = "DESCENDING",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("database-id"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("__name__"),
Order: pulumi.String("DESCENDING"),
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "database-id"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
fields {
field_path = "__name__"
order = "DESCENDING"
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("database-id")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.fields(IndexFieldArgs.builder()
.fieldPath("__name__")
.order("DESCENDING")
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id
locationId: nam5
type: FIRESTORE_NATIVE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
fields:
- fieldPath: __name__
order: DESCENDING
Firestore Index Mongodb Compatible Scope
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "database-id-mongodb-compatible",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
databaseEdition: "ENTERPRISE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
apiScope: "MONGODB_COMPATIBLE_API",
queryScope: "COLLECTION_GROUP",
multikey: true,
density: "DENSE",
fields: [
{
fieldPath: "name",
order: "ASCENDING",
},
{
fieldPath: "description",
order: "DESCENDING",
},
],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="database-id-mongodb-compatible",
location_id="nam5",
type="FIRESTORE_NATIVE",
database_edition="ENTERPRISE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
api_scope="MONGODB_COMPATIBLE_API",
query_scope="COLLECTION_GROUP",
multikey=True,
density="DENSE",
fields=[
{
"field_path": "name",
"order": "ASCENDING",
},
{
"field_path": "description",
"order": "DESCENDING",
},
])
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 = "database-id-mongodb-compatible",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DatabaseEdition = "ENTERPRISE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
ApiScope = "MONGODB_COMPATIBLE_API",
QueryScope = "COLLECTION_GROUP",
Multikey = true,
Density = "DENSE",
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "name",
Order = "ASCENDING",
},
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "description",
Order = "DESCENDING",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("database-id-mongodb-compatible"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DatabaseEdition: pulumi.String("ENTERPRISE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
ApiScope: pulumi.String("MONGODB_COMPATIBLE_API"),
QueryScope: pulumi.String("COLLECTION_GROUP"),
Multikey: pulumi.Bool(true),
Density: pulumi.String("DENSE"),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("name"),
Order: pulumi.String("ASCENDING"),
},
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("description"),
Order: pulumi.String("DESCENDING"),
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "database-id-mongodb-compatible"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
database_edition = "ENTERPRISE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
api_scope = "MONGODB_COMPATIBLE_API"
query_scope = "COLLECTION_GROUP"
multikey = true
density = "DENSE"
fields {
field_path = "name"
order = "ASCENDING"
}
fields {
field_path = "description"
order = "DESCENDING"
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("database-id-mongodb-compatible")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.databaseEdition("ENTERPRISE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.apiScope("MONGODB_COMPATIBLE_API")
.queryScope("COLLECTION_GROUP")
.multikey(true)
.density("DENSE")
.fields(
IndexFieldArgs.builder()
.fieldPath("name")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("description")
.order("DESCENDING")
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id-mongodb-compatible
locationId: nam5
type: FIRESTORE_NATIVE
databaseEdition: ENTERPRISE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
apiScope: MONGODB_COMPATIBLE_API
queryScope: COLLECTION_GROUP
multikey: true
density: DENSE
fields:
- fieldPath: name
order: ASCENDING
- fieldPath: description
order: DESCENDING
Firestore Index Sparse Any
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "database-id-sparse-any",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
databaseEdition: "ENTERPRISE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
apiScope: "MONGODB_COMPATIBLE_API",
queryScope: "COLLECTION_GROUP",
multikey: true,
density: "SPARSE_ANY",
fields: [
{
fieldPath: "name",
order: "ASCENDING",
},
{
fieldPath: "description",
order: "DESCENDING",
},
],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="database-id-sparse-any",
location_id="nam5",
type="FIRESTORE_NATIVE",
database_edition="ENTERPRISE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
api_scope="MONGODB_COMPATIBLE_API",
query_scope="COLLECTION_GROUP",
multikey=True,
density="SPARSE_ANY",
fields=[
{
"field_path": "name",
"order": "ASCENDING",
},
{
"field_path": "description",
"order": "DESCENDING",
},
])
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 = "database-id-sparse-any",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DatabaseEdition = "ENTERPRISE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
ApiScope = "MONGODB_COMPATIBLE_API",
QueryScope = "COLLECTION_GROUP",
Multikey = true,
Density = "SPARSE_ANY",
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "name",
Order = "ASCENDING",
},
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "description",
Order = "DESCENDING",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("database-id-sparse-any"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DatabaseEdition: pulumi.String("ENTERPRISE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
ApiScope: pulumi.String("MONGODB_COMPATIBLE_API"),
QueryScope: pulumi.String("COLLECTION_GROUP"),
Multikey: pulumi.Bool(true),
Density: pulumi.String("SPARSE_ANY"),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("name"),
Order: pulumi.String("ASCENDING"),
},
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("description"),
Order: pulumi.String("DESCENDING"),
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "database-id-sparse-any"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
database_edition = "ENTERPRISE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
api_scope = "MONGODB_COMPATIBLE_API"
query_scope = "COLLECTION_GROUP"
multikey = true
density = "SPARSE_ANY"
fields {
field_path = "name"
order = "ASCENDING"
}
fields {
field_path = "description"
order = "DESCENDING"
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("database-id-sparse-any")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.databaseEdition("ENTERPRISE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.apiScope("MONGODB_COMPATIBLE_API")
.queryScope("COLLECTION_GROUP")
.multikey(true)
.density("SPARSE_ANY")
.fields(
IndexFieldArgs.builder()
.fieldPath("name")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("description")
.order("DESCENDING")
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id-sparse-any
locationId: nam5
type: FIRESTORE_NATIVE
databaseEdition: ENTERPRISE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
apiScope: MONGODB_COMPATIBLE_API
queryScope: COLLECTION_GROUP
multikey: true
density: SPARSE_ANY
fields:
- fieldPath: name
order: ASCENDING
- fieldPath: description
order: DESCENDING
Firestore Index Unique
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "database-id-unique",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
databaseEdition: "ENTERPRISE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
apiScope: "MONGODB_COMPATIBLE_API",
queryScope: "COLLECTION_GROUP",
multikey: true,
density: "DENSE",
unique: true,
fields: [
{
fieldPath: "name",
order: "ASCENDING",
},
{
fieldPath: "description",
order: "DESCENDING",
},
],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="database-id-unique",
location_id="nam5",
type="FIRESTORE_NATIVE",
database_edition="ENTERPRISE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
api_scope="MONGODB_COMPATIBLE_API",
query_scope="COLLECTION_GROUP",
multikey=True,
density="DENSE",
unique=True,
fields=[
{
"field_path": "name",
"order": "ASCENDING",
},
{
"field_path": "description",
"order": "DESCENDING",
},
])
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 = "database-id-unique",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DatabaseEdition = "ENTERPRISE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
ApiScope = "MONGODB_COMPATIBLE_API",
QueryScope = "COLLECTION_GROUP",
Multikey = true,
Density = "DENSE",
Unique = true,
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "name",
Order = "ASCENDING",
},
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "description",
Order = "DESCENDING",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("database-id-unique"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DatabaseEdition: pulumi.String("ENTERPRISE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
ApiScope: pulumi.String("MONGODB_COMPATIBLE_API"),
QueryScope: pulumi.String("COLLECTION_GROUP"),
Multikey: pulumi.Bool(true),
Density: pulumi.String("DENSE"),
Unique: pulumi.Bool(true),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("name"),
Order: pulumi.String("ASCENDING"),
},
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("description"),
Order: pulumi.String("DESCENDING"),
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "database-id-unique"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
database_edition = "ENTERPRISE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
api_scope = "MONGODB_COMPATIBLE_API"
query_scope = "COLLECTION_GROUP"
multikey = true
density = "DENSE"
unique = true
fields {
field_path = "name"
order = "ASCENDING"
}
fields {
field_path = "description"
order = "DESCENDING"
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("database-id-unique")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.databaseEdition("ENTERPRISE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.apiScope("MONGODB_COMPATIBLE_API")
.queryScope("COLLECTION_GROUP")
.multikey(true)
.density("DENSE")
.unique(true)
.fields(
IndexFieldArgs.builder()
.fieldPath("name")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("description")
.order("DESCENDING")
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id-unique
locationId: nam5
type: FIRESTORE_NATIVE
databaseEdition: ENTERPRISE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
apiScope: MONGODB_COMPATIBLE_API
queryScope: COLLECTION_GROUP
multikey: true
density: DENSE
unique: true
fields:
- fieldPath: name
order: ASCENDING
- fieldPath: description
order: DESCENDING
Firestore Index Skip Wait
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "database-id-skip-wait",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
fields: [
{
fieldPath: "name",
order: "ASCENDING",
},
{
fieldPath: "description",
order: "DESCENDING",
},
],
skipWait: true,
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="database-id-skip-wait",
location_id="nam5",
type="FIRESTORE_NATIVE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
fields=[
{
"field_path": "name",
"order": "ASCENDING",
},
{
"field_path": "description",
"order": "DESCENDING",
},
],
skip_wait=True)
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 = "database-id-skip-wait",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "name",
Order = "ASCENDING",
},
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "description",
Order = "DESCENDING",
},
},
SkipWait = true,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("database-id-skip-wait"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("name"),
Order: pulumi.String("ASCENDING"),
},
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("description"),
Order: pulumi.String("DESCENDING"),
},
},
SkipWait: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "database-id-skip-wait"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
fields {
field_path = "name"
order = "ASCENDING"
}
fields {
field_path = "description"
order = "DESCENDING"
}
skip_wait = true
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("database-id-skip-wait")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.fields(
IndexFieldArgs.builder()
.fieldPath("name")
.order("ASCENDING")
.build(),
IndexFieldArgs.builder()
.fieldPath("description")
.order("DESCENDING")
.build())
.skipWait(true)
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id-skip-wait
locationId: nam5
type: FIRESTORE_NATIVE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
fields:
- fieldPath: name
order: ASCENDING
- fieldPath: description
order: DESCENDING
skipWait: true
Firestore Index Text Search
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "text-search-database-id",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
databaseEdition: "ENTERPRISE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
apiScope: "MONGODB_COMPATIBLE_API",
queryScope: "COLLECTION_GROUP",
multikey: true,
fields: [{
fieldPath: "description",
searchConfig: {
textSpec: {
indexSpecs: [{
indexType: "TOKENIZED",
matchType: "MATCH_GLOBALLY",
}],
},
},
}],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="text-search-database-id",
location_id="nam5",
type="FIRESTORE_NATIVE",
database_edition="ENTERPRISE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
api_scope="MONGODB_COMPATIBLE_API",
query_scope="COLLECTION_GROUP",
multikey=True,
fields=[{
"field_path": "description",
"search_config": {
"text_spec": {
"index_specs": [{
"index_type": "TOKENIZED",
"match_type": "MATCH_GLOBALLY",
}],
},
},
}])
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 = "text-search-database-id",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DatabaseEdition = "ENTERPRISE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
ApiScope = "MONGODB_COMPATIBLE_API",
QueryScope = "COLLECTION_GROUP",
Multikey = true,
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "description",
SearchConfig = new Gcp.Firestore.Inputs.IndexFieldSearchConfigArgs
{
TextSpec = new Gcp.Firestore.Inputs.IndexFieldSearchConfigTextSpecArgs
{
IndexSpecs = new[]
{
new Gcp.Firestore.Inputs.IndexFieldSearchConfigTextSpecIndexSpecArgs
{
IndexType = "TOKENIZED",
MatchType = "MATCH_GLOBALLY",
},
},
},
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("text-search-database-id"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DatabaseEdition: pulumi.String("ENTERPRISE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
ApiScope: pulumi.String("MONGODB_COMPATIBLE_API"),
QueryScope: pulumi.String("COLLECTION_GROUP"),
Multikey: pulumi.Bool(true),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("description"),
SearchConfig: &firestore.IndexFieldSearchConfigArgs{
TextSpec: &firestore.IndexFieldSearchConfigTextSpecArgs{
IndexSpecs: firestore.IndexFieldSearchConfigTextSpecIndexSpecArray{
&firestore.IndexFieldSearchConfigTextSpecIndexSpecArgs{
IndexType: pulumi.String("TOKENIZED"),
MatchType: pulumi.String("MATCH_GLOBALLY"),
},
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "text-search-database-id"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
database_edition = "ENTERPRISE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
api_scope = "MONGODB_COMPATIBLE_API"
query_scope = "COLLECTION_GROUP"
multikey = true
fields {
field_path = "description"
search_config = {
text_spec = {
index_specs = [{
"indexType" = "TOKENIZED"
"matchType" = "MATCH_GLOBALLY"
}]
}
}
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldSearchConfigArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldSearchConfigTextSpecArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldSearchConfigTextSpecIndexSpecArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("text-search-database-id")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.databaseEdition("ENTERPRISE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.apiScope("MONGODB_COMPATIBLE_API")
.queryScope("COLLECTION_GROUP")
.multikey(true)
.fields(IndexFieldArgs.builder()
.fieldPath("description")
.searchConfig(IndexFieldSearchConfigArgs.builder()
.textSpec(IndexFieldSearchConfigTextSpecArgs.builder()
.indexSpecs(IndexFieldSearchConfigTextSpecIndexSpecArgs.builder()
.indexType("TOKENIZED")
.matchType("MATCH_GLOBALLY")
.build())
.build())
.build())
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: text-search-database-id
locationId: nam5
type: FIRESTORE_NATIVE
databaseEdition: ENTERPRISE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
apiScope: MONGODB_COMPATIBLE_API
queryScope: COLLECTION_GROUP
multikey: true
fields:
- fieldPath: description
searchConfig:
textSpec:
indexSpecs:
- indexType: TOKENIZED
matchType: MATCH_GLOBALLY
Firestore Index Suppress Geojson Indexing
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "suppress-geojson-indexing-database-id",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
databaseEdition: "ENTERPRISE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
queryScope: "COLLECTION_GROUP",
density: "SPARSE_ANY",
fields: [{
fieldPath: "location",
searchConfig: {
geoSpec: {
geoJsonIndexingDisabled: true,
},
},
}],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="suppress-geojson-indexing-database-id",
location_id="nam5",
type="FIRESTORE_NATIVE",
database_edition="ENTERPRISE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
query_scope="COLLECTION_GROUP",
density="SPARSE_ANY",
fields=[{
"field_path": "location",
"search_config": {
"geo_spec": {
"geo_json_indexing_disabled": True,
},
},
}])
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 = "suppress-geojson-indexing-database-id",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DatabaseEdition = "ENTERPRISE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
QueryScope = "COLLECTION_GROUP",
Density = "SPARSE_ANY",
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "location",
SearchConfig = new Gcp.Firestore.Inputs.IndexFieldSearchConfigArgs
{
GeoSpec = new Gcp.Firestore.Inputs.IndexFieldSearchConfigGeoSpecArgs
{
GeoJsonIndexingDisabled = true,
},
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("suppress-geojson-indexing-database-id"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DatabaseEdition: pulumi.String("ENTERPRISE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
QueryScope: pulumi.String("COLLECTION_GROUP"),
Density: pulumi.String("SPARSE_ANY"),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("location"),
SearchConfig: &firestore.IndexFieldSearchConfigArgs{
GeoSpec: &firestore.IndexFieldSearchConfigGeoSpecArgs{
GeoJsonIndexingDisabled: pulumi.Bool(true),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "suppress-geojson-indexing-database-id"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
database_edition = "ENTERPRISE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
query_scope = "COLLECTION_GROUP"
density = "SPARSE_ANY"
fields {
field_path = "location"
search_config = {
geo_spec = {
geo_json_indexing_disabled = true
}
}
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldSearchConfigArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldSearchConfigGeoSpecArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("suppress-geojson-indexing-database-id")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.databaseEdition("ENTERPRISE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.queryScope("COLLECTION_GROUP")
.density("SPARSE_ANY")
.fields(IndexFieldArgs.builder()
.fieldPath("location")
.searchConfig(IndexFieldSearchConfigArgs.builder()
.geoSpec(IndexFieldSearchConfigGeoSpecArgs.builder()
.geoJsonIndexingDisabled(true)
.build())
.build())
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: suppress-geojson-indexing-database-id
locationId: nam5
type: FIRESTORE_NATIVE
databaseEdition: ENTERPRISE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
queryScope: COLLECTION_GROUP
density: SPARSE_ANY
fields:
- fieldPath: location
searchConfig:
geoSpec:
geoJsonIndexingDisabled: true
Firestore Index Geo Search
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const database = new gcp.firestore.Database("database", {
project: "my-project-name",
name: "geo-search-database-id",
locationId: "nam5",
type: "FIRESTORE_NATIVE",
databaseEdition: "ENTERPRISE",
deleteProtectionState: "DELETE_PROTECTION_DISABLED",
deletionPolicy: "DELETE",
});
const my_index = new gcp.firestore.Index("my-index", {
project: "my-project-name",
database: database.name,
collection: "atestcollection",
apiScope: "MONGODB_COMPATIBLE_API",
queryScope: "COLLECTION_GROUP",
multikey: true,
fields: [{
fieldPath: "location",
searchConfig: {
geoSpec: {
geoJsonIndexingDisabled: false,
},
},
}],
});
import pulumi
import pulumi_gcp as gcp
database = gcp.firestore.Database("database",
project="my-project-name",
name="geo-search-database-id",
location_id="nam5",
type="FIRESTORE_NATIVE",
database_edition="ENTERPRISE",
delete_protection_state="DELETE_PROTECTION_DISABLED",
deletion_policy="DELETE")
my_index = gcp.firestore.Index("my-index",
project="my-project-name",
database=database.name,
collection="atestcollection",
api_scope="MONGODB_COMPATIBLE_API",
query_scope="COLLECTION_GROUP",
multikey=True,
fields=[{
"field_path": "location",
"search_config": {
"geo_spec": {
"geo_json_indexing_disabled": False,
},
},
}])
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 = "geo-search-database-id",
LocationId = "nam5",
Type = "FIRESTORE_NATIVE",
DatabaseEdition = "ENTERPRISE",
DeleteProtectionState = "DELETE_PROTECTION_DISABLED",
DeletionPolicy = "DELETE",
});
var my_index = new Gcp.Firestore.Index("my-index", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "atestcollection",
ApiScope = "MONGODB_COMPATIBLE_API",
QueryScope = "COLLECTION_GROUP",
Multikey = true,
Fields = new[]
{
new Gcp.Firestore.Inputs.IndexFieldArgs
{
FieldPath = "location",
SearchConfig = new Gcp.Firestore.Inputs.IndexFieldSearchConfigArgs
{
GeoSpec = new Gcp.Firestore.Inputs.IndexFieldSearchConfigGeoSpecArgs
{
GeoJsonIndexingDisabled = false,
},
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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("geo-search-database-id"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DatabaseEdition: pulumi.String("ENTERPRISE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_DISABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewIndex(ctx, "my-index", &firestore.IndexArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("atestcollection"),
ApiScope: pulumi.String("MONGODB_COMPATIBLE_API"),
QueryScope: pulumi.String("COLLECTION_GROUP"),
Multikey: pulumi.Bool(true),
Fields: firestore.IndexFieldArray{
&firestore.IndexFieldArgs{
FieldPath: pulumi.String("location"),
SearchConfig: &firestore.IndexFieldSearchConfigArgs{
GeoSpec: &firestore.IndexFieldSearchConfigGeoSpecArgs{
GeoJsonIndexingDisabled: pulumi.Bool(false),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_firestore_database" "database" {
project = "my-project-name"
name = "geo-search-database-id"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
database_edition = "ENTERPRISE"
delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
}
resource "gcp_firestore_index" "my-index" {
project = "my-project-name"
database = gcp_firestore_database.database.name
collection = "atestcollection"
api_scope = "MONGODB_COMPATIBLE_API"
query_scope = "COLLECTION_GROUP"
multikey = true
fields {
field_path = "location"
search_config = {
geo_spec = {
geo_json_indexing_disabled = false
}
}
}
}
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.firestore.Index;
import com.pulumi.gcp.firestore.IndexArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldSearchConfigArgs;
import com.pulumi.gcp.firestore.inputs.IndexFieldSearchConfigGeoSpecArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("geo-search-database-id")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.databaseEdition("ENTERPRISE")
.deleteProtectionState("DELETE_PROTECTION_DISABLED")
.deletionPolicy("DELETE")
.build());
var my_index = new Index("my-index", IndexArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("atestcollection")
.apiScope("MONGODB_COMPATIBLE_API")
.queryScope("COLLECTION_GROUP")
.multikey(true)
.fields(IndexFieldArgs.builder()
.fieldPath("location")
.searchConfig(IndexFieldSearchConfigArgs.builder()
.geoSpec(IndexFieldSearchConfigGeoSpecArgs.builder()
.geoJsonIndexingDisabled(false)
.build())
.build())
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: geo-search-database-id
locationId: nam5
type: FIRESTORE_NATIVE
databaseEdition: ENTERPRISE
deleteProtectionState: DELETE_PROTECTION_DISABLED
deletionPolicy: DELETE
my-index:
type: gcp:firestore:Index
properties:
project: my-project-name
database: ${database.name}
collection: atestcollection
apiScope: MONGODB_COMPATIBLE_API
queryScope: COLLECTION_GROUP
multikey: true
fields:
- fieldPath: location
searchConfig:
geoSpec:
geoJsonIndexingDisabled: false
Import
Index can be imported using any of these accepted formats:
{{name}}
When using the pulumi import command, Index can be imported using one of the formats above. For example:
$ pulumi import gcp:firestore/index:Index default {{name}}
Constructors
- Index(String name, {IndexArgs? args, CustomResourceOptions? options})
-
Creates a new Index.
nameThe Pulumi resource name.argsArguments used to configure this Index. The set of arguments for Index.optionsResource options controlling this resource's behavior. - Index.reference(String urn)
- Creates a typed reference to an existing Index resource.
Properties
-
apiScope
↔ Output<
String?> -
The API scope at which a query is run.
Default value is
ANY_API. Possible values are:ANY_API,DATASTORE_MODE_API,MONGODB_COMPATIBLE_API.latefinal -
childResources
→ Set<
Resource> -
finalinherited
-
collection
↔ Output<
String> -
The collection being indexed.
latefinal
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
database
↔ Output<
String?> -
The Firestore database id. Defaults to
"(default)".latefinal -
deletionPolicy
↔ Output<
String> -
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
When a 'terraform destroy' or 'pulumi up' would delete the resource,
the command will fail if this field is set to "PREVENT" in Terraform state.
When set to "ABANDON", the command will remove the resource from Terraform
management without updating or deleting the resource in the API.
When set to "DELETE", deleting the resource is allowed.
latefinal
-
density
↔ Output<
String> -
The density configuration for this index.
Possible values are:
SPARSE_ALL,SPARSE_ANY,DENSE.latefinal -
fields
↔ Output<
List< IndexField> > -
The field(s) supported by this index. Indexes with the
ANY_APIapiScopein Standard edition databases have special behavior with respect to the__name__field. In these indexes, the last non-stored 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 an index is not directional, the__name__will be ordered"ASCENDING"(unless explicitly specified otherwise). Structure is documented below.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
multikey
↔ Output<
bool?> -
Optional. Whether the index is multikey. By default, the index is not multikey. For non-multikey indexes, none of the paths in the index definition reach or traverse an array, except via an explicit array index. For multikey indexes, at most one of the paths in the index definition reach or traverse an array, except via an explicit array index. Violations will result in errors. Note this field only applies to indexes with MONGODB_COMPATIBLE_API ApiScope.
latefinal
-
name
↔ Output<
String> -
A server defined name for this index. Format:
projects/{{project}}/databases/{{database}}/collectionGroups/{{collection}}/indexes/{{server_generated_id}}latefinal -
project
↔ Output<
String> -
The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
latefinal
-
queryScope
↔ Output<
String?> -
The scope at which a query is run.
Default value is
COLLECTION. Possible values are:COLLECTION,COLLECTION_GROUP,COLLECTION_RECURSIVE.latefinal -
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
skipWait
↔ Output<
bool?> -
Whether to skip waiting for the index to be created.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
unique
↔ Output<
bool> -
Whether it is an unique index. Unique index ensures all values for the indexed field(s) are unique across documents.
latefinal
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited