Field Args
Represents a single field in the database. Fields are grouped by their "Collection Group", which represent all collections in the database with the same id. To get more information about Field, see:
How-to Guides
Warning: This resource creates a Firestore Single Field override on a project that already has a Firestore database. If you haven't already created it, you may create a
gcp.firestore.Database
resource withlocation_id
set to your chosen location.
Example Usage
Firestore Field 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_ENABLED",
deletionPolicy: "DELETE",
});
const basic = new gcp.firestore.Field("basic", {
project: "my-project-name",
database: database.name,
collection: "chatrooms__75125",
field: "basic",
indexConfig: {
indexes: [
{
order: "ASCENDING",
queryScope: "COLLECTION_GROUP",
},
{
arrayConfig: "CONTAINS",
},
],
},
});
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_ENABLED",
deletion_policy="DELETE")
basic = gcp.firestore.Field("basic",
project="my-project-name",
database=database.name,
collection="chatrooms__75125",
field="basic",
index_config={
"indexes": [
{
"order": "ASCENDING",
"query_scope": "COLLECTION_GROUP",
},
{
"array_config": "CONTAINS",
},
],
})
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_ENABLED",
DeletionPolicy = "DELETE",
});
var basic = new Gcp.Firestore.Field("basic", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "chatrooms__75125",
FieldId = "basic",
IndexConfig = new Gcp.Firestore.Inputs.FieldIndexConfigArgs
{
Indexes = new[]
{
new Gcp.Firestore.Inputs.FieldIndexConfigIndexArgs
{
Order = "ASCENDING",
QueryScope = "COLLECTION_GROUP",
},
new Gcp.Firestore.Inputs.FieldIndexConfigIndexArgs
{
ArrayConfig = "CONTAINS",
},
},
},
});
});
package main
import (
"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("database-id"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_ENABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewField(ctx, "basic", &firestore.FieldArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("chatrooms__75125"),
Field: pulumi.String("basic"),
IndexConfig: &firestore.FieldIndexConfigArgs{
Indexes: firestore.FieldIndexConfigIndexArray{
&firestore.FieldIndexConfigIndexArgs{
Order: pulumi.String("ASCENDING"),
QueryScope: pulumi.String("COLLECTION_GROUP"),
},
&firestore.FieldIndexConfigIndexArgs{
ArrayConfig: pulumi.String("CONTAINS"),
},
},
},
})
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.firestore.Field;
import com.pulumi.gcp.firestore.FieldArgs;
import com.pulumi.gcp.firestore.inputs.FieldIndexConfigArgs;
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("database-id")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.deleteProtectionState("DELETE_PROTECTION_ENABLED")
.deletionPolicy("DELETE")
.build());
var basic = new Field("basic", FieldArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("chatrooms__75125")
.field("basic")
.indexConfig(FieldIndexConfigArgs.builder()
.indexes(
FieldIndexConfigIndexArgs.builder()
.order("ASCENDING")
.queryScope("COLLECTION_GROUP")
.build(),
FieldIndexConfigIndexArgs.builder()
.arrayConfig("CONTAINS")
.build())
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id
locationId: nam5
type: FIRESTORE_NATIVE
deleteProtectionState: DELETE_PROTECTION_ENABLED
deletionPolicy: DELETE
basic:
type: gcp:firestore:Field
properties:
project: my-project-name
database: ${database.name}
collection: chatrooms__75125
field: basic
indexConfig:
indexes:
- order: ASCENDING
queryScope: COLLECTION_GROUP
- arrayConfig: CONTAINS
Firestore Field Timestamp
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_ENABLED",
deletionPolicy: "DELETE",
});
const timestamp = new gcp.firestore.Field("timestamp", {
project: "my-project-name",
database: database.name,
collection: "chatrooms",
field: "timestamp",
ttlConfig: {},
indexConfig: {},
});
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_ENABLED",
deletion_policy="DELETE")
timestamp = gcp.firestore.Field("timestamp",
project="my-project-name",
database=database.name,
collection="chatrooms",
field="timestamp",
ttl_config={},
index_config={})
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_ENABLED",
DeletionPolicy = "DELETE",
});
var timestamp = new Gcp.Firestore.Field("timestamp", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "chatrooms",
FieldId = "timestamp",
TtlConfig = null,
IndexConfig = null,
});
});
package main
import (
"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("database-id"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_ENABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewField(ctx, "timestamp", &firestore.FieldArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("chatrooms"),
Field: pulumi.String("timestamp"),
TtlConfig: nil,
IndexConfig: nil,
})
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.firestore.Field;
import com.pulumi.gcp.firestore.FieldArgs;
import com.pulumi.gcp.firestore.inputs.FieldTtlConfigArgs;
import com.pulumi.gcp.firestore.inputs.FieldIndexConfigArgs;
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("database-id")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.deleteProtectionState("DELETE_PROTECTION_ENABLED")
.deletionPolicy("DELETE")
.build());
var timestamp = new Field("timestamp", FieldArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("chatrooms")
.field("timestamp")
.ttlConfig()
.indexConfig()
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id
locationId: nam5
type: FIRESTORE_NATIVE
deleteProtectionState: DELETE_PROTECTION_ENABLED
deletionPolicy: DELETE
timestamp:
type: gcp:firestore:Field
properties:
project: my-project-name
database: ${database.name}
collection: chatrooms
field: timestamp
ttlConfig: {}
indexConfig: {}
Firestore Field Match Override
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_ENABLED",
deletionPolicy: "DELETE",
});
const matchOverride = new gcp.firestore.Field("match_override", {
project: "my-project-name",
database: database.name,
collection: "chatrooms__88722",
field: "field_with_same_configuration_as_ancestor",
indexConfig: {
indexes: [
{
order: "ASCENDING",
},
{
order: "DESCENDING",
},
{
arrayConfig: "CONTAINS",
},
],
},
});
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_ENABLED",
deletion_policy="DELETE")
match_override = gcp.firestore.Field("match_override",
project="my-project-name",
database=database.name,
collection="chatrooms__88722",
field="field_with_same_configuration_as_ancestor",
index_config={
"indexes": [
{
"order": "ASCENDING",
},
{
"order": "DESCENDING",
},
{
"array_config": "CONTAINS",
},
],
})
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_ENABLED",
DeletionPolicy = "DELETE",
});
var matchOverride = new Gcp.Firestore.Field("match_override", new()
{
Project = "my-project-name",
Database = database.Name,
Collection = "chatrooms__88722",
FieldId = "field_with_same_configuration_as_ancestor",
IndexConfig = new Gcp.Firestore.Inputs.FieldIndexConfigArgs
{
Indexes = new[]
{
new Gcp.Firestore.Inputs.FieldIndexConfigIndexArgs
{
Order = "ASCENDING",
},
new Gcp.Firestore.Inputs.FieldIndexConfigIndexArgs
{
Order = "DESCENDING",
},
new Gcp.Firestore.Inputs.FieldIndexConfigIndexArgs
{
ArrayConfig = "CONTAINS",
},
},
},
});
});
package main
import (
"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("database-id"),
LocationId: pulumi.String("nam5"),
Type: pulumi.String("FIRESTORE_NATIVE"),
DeleteProtectionState: pulumi.String("DELETE_PROTECTION_ENABLED"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
_, err = firestore.NewField(ctx, "match_override", &firestore.FieldArgs{
Project: pulumi.String("my-project-name"),
Database: database.Name,
Collection: pulumi.String("chatrooms__88722"),
Field: pulumi.String("field_with_same_configuration_as_ancestor"),
IndexConfig: &firestore.FieldIndexConfigArgs{
Indexes: firestore.FieldIndexConfigIndexArray{
&firestore.FieldIndexConfigIndexArgs{
Order: pulumi.String("ASCENDING"),
},
&firestore.FieldIndexConfigIndexArgs{
Order: pulumi.String("DESCENDING"),
},
&firestore.FieldIndexConfigIndexArgs{
ArrayConfig: pulumi.String("CONTAINS"),
},
},
},
})
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.firestore.Field;
import com.pulumi.gcp.firestore.FieldArgs;
import com.pulumi.gcp.firestore.inputs.FieldIndexConfigArgs;
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("database-id")
.locationId("nam5")
.type("FIRESTORE_NATIVE")
.deleteProtectionState("DELETE_PROTECTION_ENABLED")
.deletionPolicy("DELETE")
.build());
var matchOverride = new Field("matchOverride", FieldArgs.builder()
.project("my-project-name")
.database(database.name())
.collection("chatrooms__88722")
.field("field_with_same_configuration_as_ancestor")
.indexConfig(FieldIndexConfigArgs.builder()
.indexes(
FieldIndexConfigIndexArgs.builder()
.order("ASCENDING")
.build(),
FieldIndexConfigIndexArgs.builder()
.order("DESCENDING")
.build(),
FieldIndexConfigIndexArgs.builder()
.arrayConfig("CONTAINS")
.build())
.build())
.build());
}
}
resources:
database:
type: gcp:firestore:Database
properties:
project: my-project-name
name: database-id
locationId: nam5
type: FIRESTORE_NATIVE
deleteProtectionState: DELETE_PROTECTION_ENABLED
deletionPolicy: DELETE
matchOverride:
type: gcp:firestore:Field
name: match_override
properties:
project: my-project-name
database: ${database.name}
collection: chatrooms__88722
field: field_with_same_configuration_as_ancestor
indexConfig:
indexes:
- order: ASCENDING
- order: DESCENDING
- arrayConfig: CONTAINS
Import
Field can be imported using any of these accepted formats:
{{name}}
When using thepulumi import
command, Field can be imported using one of the formats above. For example:
$ pulumi import gcp:firestore/field:Field default {{name}}
Constructors
Properties
The id of the collection group to configure.
The single field index configuration for this field. Creating an index configuration for this field will override any inherited configuration with the indexes specified. Configuring the index configuration with an empty block disables all indexes on the field. Structure is documented below.
The TTL configuration for this Field. If set to an empty block (i.e. ttl_config {}
), a TTL policy is configured based on the field. If unset, a TTL policy is not configured (or will be disabled upon updating the resource). Structure is documented below.