1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. firestore
  5. Document
Google Cloud v8.27.1 published on Friday, Apr 25, 2025 by Pulumi

gcp.firestore.Document

Explore with Pulumi AI

In Cloud Firestore, the unit of storage is the document. A document is a lightweight record that contains fields, which map to values. Each document is identified by a name.

To get more information about Document, see:

Warning: This resource creates a Firestore Document on a project that already has a Firestore database. If you haven’t already created it, you may create a gcp.firestore.Database resource with type set to "FIRESTORE_NATIVE" and location_id set to your chosen location. If you wish to use App Engine, you may instead create a gcp.appengine.Application resource with database_type set to "CLOUD_FIRESTORE". Your Firestore location will be the same as the App Engine location specified.

Example Usage

Firestore Document Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as time from "@pulumi/time";

const project = new gcp.organizations.Project("project", {
    projectId: "project-id",
    name: "project-id",
    orgId: "123456789",
    deletionPolicy: "DELETE",
});
const wait60Seconds = new time.index.Sleep("wait_60_seconds", {createDuration: "60s"}, {
    dependsOn: [project],
});
const firestore = new gcp.projects.Service("firestore", {
    project: project.projectId,
    service: "firestore.googleapis.com",
}, {
    dependsOn: [wait60Seconds],
});
const database = new gcp.firestore.Database("database", {
    project: project.projectId,
    name: "(default)",
    locationId: "nam5",
    type: "FIRESTORE_NATIVE",
}, {
    dependsOn: [firestore],
});
const mydoc = new gcp.firestore.Document("mydoc", {
    project: project.projectId,
    database: database.name,
    collection: "somenewcollection",
    documentId: "my-doc-id",
    fields: "{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}",
});
Copy
import pulumi
import pulumi_gcp as gcp
import pulumi_time as time

project = gcp.organizations.Project("project",
    project_id="project-id",
    name="project-id",
    org_id="123456789",
    deletion_policy="DELETE")
wait60_seconds = time.index.Sleep("wait_60_seconds", create_duration=60s,
opts = pulumi.ResourceOptions(depends_on=[project]))
firestore = gcp.projects.Service("firestore",
    project=project.project_id,
    service="firestore.googleapis.com",
    opts = pulumi.ResourceOptions(depends_on=[wait60_seconds]))
database = gcp.firestore.Database("database",
    project=project.project_id,
    name="(default)",
    location_id="nam5",
    type="FIRESTORE_NATIVE",
    opts = pulumi.ResourceOptions(depends_on=[firestore]))
mydoc = gcp.firestore.Document("mydoc",
    project=project.project_id,
    database=database.name,
    collection="somenewcollection",
    document_id="my-doc-id",
    fields="{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}")
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/firestore"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/projects"
	"github.com/pulumi/pulumi-time/sdk/go/time"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.NewProject(ctx, "project", &organizations.ProjectArgs{
			ProjectId:      pulumi.String("project-id"),
			Name:           pulumi.String("project-id"),
			OrgId:          pulumi.String("123456789"),
			DeletionPolicy: pulumi.String("DELETE"),
		})
		if err != nil {
			return err
		}
		wait60Seconds, err := time.NewSleep(ctx, "wait_60_seconds", &time.SleepArgs{
			CreateDuration: "60s",
		}, pulumi.DependsOn([]pulumi.Resource{
			project,
		}))
		if err != nil {
			return err
		}
		firestore, err := projects.NewService(ctx, "firestore", &projects.ServiceArgs{
			Project: project.ProjectId,
			Service: pulumi.String("firestore.googleapis.com"),
		}, pulumi.DependsOn([]pulumi.Resource{
			wait60Seconds,
		}))
		if err != nil {
			return err
		}
		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
			Project:    project.ProjectId,
			Name:       pulumi.String("(default)"),
			LocationId: pulumi.String("nam5"),
			Type:       pulumi.String("FIRESTORE_NATIVE"),
		}, pulumi.DependsOn([]pulumi.Resource{
			firestore,
		}))
		if err != nil {
			return err
		}
		_, err = firestore.NewDocument(ctx, "mydoc", &firestore.DocumentArgs{
			Project:    project.ProjectId,
			Database:   database.Name,
			Collection: pulumi.String("somenewcollection"),
			DocumentId: pulumi.String("my-doc-id"),
			Fields:     pulumi.String("{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Time = Pulumi.Time;

return await Deployment.RunAsync(() => 
{
    var project = new Gcp.Organizations.Project("project", new()
    {
        ProjectId = "project-id",
        Name = "project-id",
        OrgId = "123456789",
        DeletionPolicy = "DELETE",
    });

    var wait60Seconds = new Time.Index.Sleep("wait_60_seconds", new()
    {
        CreateDuration = "60s",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            project,
        },
    });

    var firestore = new Gcp.Projects.Service("firestore", new()
    {
        Project = project.ProjectId,
        ServiceName = "firestore.googleapis.com",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            wait60Seconds,
        },
    });

    var database = new Gcp.Firestore.Database("database", new()
    {
        Project = project.ProjectId,
        Name = "(default)",
        LocationId = "nam5",
        Type = "FIRESTORE_NATIVE",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            firestore,
        },
    });

    var mydoc = new Gcp.Firestore.Document("mydoc", new()
    {
        Project = project.ProjectId,
        Database = database.Name,
        Collection = "somenewcollection",
        DocumentId = "my-doc-id",
        Fields = "{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
import com.pulumi.time.sleep;
import com.pulumi.time.sleepArgs;
import com.pulumi.gcp.projects.Service;
import com.pulumi.gcp.projects.ServiceArgs;
import com.pulumi.gcp.firestore.Database;
import com.pulumi.gcp.firestore.DatabaseArgs;
import com.pulumi.gcp.firestore.Document;
import com.pulumi.gcp.firestore.DocumentArgs;
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 project = new Project("project", ProjectArgs.builder()
            .projectId("project-id")
            .name("project-id")
            .orgId("123456789")
            .deletionPolicy("DELETE")
            .build());

        var wait60Seconds = new Sleep("wait60Seconds", SleepArgs.builder()
            .createDuration("60s")
            .build(), CustomResourceOptions.builder()
                .dependsOn(List.of(project))
                .build());

        var firestore = new Service("firestore", ServiceArgs.builder()
            .project(project.projectId())
            .service("firestore.googleapis.com")
            .build(), CustomResourceOptions.builder()
                .dependsOn(wait60Seconds)
                .build());

        var database = new Database("database", DatabaseArgs.builder()
            .project(project.projectId())
            .name("(default)")
            .locationId("nam5")
            .type("FIRESTORE_NATIVE")
            .build(), CustomResourceOptions.builder()
                .dependsOn(firestore)
                .build());

        var mydoc = new Document("mydoc", DocumentArgs.builder()
            .project(project.projectId())
            .database(database.name())
            .collection("somenewcollection")
            .documentId("my-doc-id")
            .fields("{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}")
            .build());

    }
}
Copy
resources:
  project:
    type: gcp:organizations:Project
    properties:
      projectId: project-id
      name: project-id
      orgId: '123456789'
      deletionPolicy: DELETE
  wait60Seconds:
    type: time:sleep
    name: wait_60_seconds
    properties:
      createDuration: 60s
    options:
      dependsOn:
        - ${project}
  firestore:
    type: gcp:projects:Service
    properties:
      project: ${project.projectId}
      service: firestore.googleapis.com
    options:
      dependsOn:
        - ${wait60Seconds}
  database:
    type: gcp:firestore:Database
    properties:
      project: ${project.projectId}
      name: (default)
      locationId: nam5
      type: FIRESTORE_NATIVE
    options:
      dependsOn:
        - ${firestore}
  mydoc:
    type: gcp:firestore:Document
    properties:
      project: ${project.projectId}
      database: ${database.name}
      collection: somenewcollection
      documentId: my-doc-id
      fields: '{"something":{"mapValue":{"fields":{"akey":{"stringValue":"avalue"}}}}}'
Copy

Firestore Document Nested Document

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as time from "@pulumi/time";

const project = new gcp.organizations.Project("project", {
    projectId: "project-id",
    name: "project-id",
    orgId: "123456789",
    deletionPolicy: "DELETE",
});
const wait60Seconds = new time.index.Sleep("wait_60_seconds", {createDuration: "60s"}, {
    dependsOn: [project],
});
const firestore = new gcp.projects.Service("firestore", {
    project: project.projectId,
    service: "firestore.googleapis.com",
}, {
    dependsOn: [wait60Seconds],
});
const database = new gcp.firestore.Database("database", {
    project: project.projectId,
    name: "(default)",
    locationId: "nam5",
    type: "FIRESTORE_NATIVE",
}, {
    dependsOn: [firestore],
});
const mydoc = new gcp.firestore.Document("mydoc", {
    project: project.projectId,
    database: database.name,
    collection: "somenewcollection",
    documentId: "my-doc-id",
    fields: "{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}",
});
const subDocument = new gcp.firestore.Document("sub_document", {
    project: project.projectId,
    database: database.name,
    collection: pulumi.interpolate`${mydoc.path}/subdocs`,
    documentId: "bitcoinkey",
    fields: "{\"something\":{\"mapValue\":{\"fields\":{\"ayo\":{\"stringValue\":\"val2\"}}}}}",
});
const subSubDocument = new gcp.firestore.Document("sub_sub_document", {
    project: project.projectId,
    database: database.name,
    collection: pulumi.interpolate`${subDocument.path}/subsubdocs`,
    documentId: "asecret",
    fields: "{\"something\":{\"mapValue\":{\"fields\":{\"secret\":{\"stringValue\":\"hithere\"}}}}}",
});
Copy
import pulumi
import pulumi_gcp as gcp
import pulumi_time as time

project = gcp.organizations.Project("project",
    project_id="project-id",
    name="project-id",
    org_id="123456789",
    deletion_policy="DELETE")
wait60_seconds = time.index.Sleep("wait_60_seconds", create_duration=60s,
opts = pulumi.ResourceOptions(depends_on=[project]))
firestore = gcp.projects.Service("firestore",
    project=project.project_id,
    service="firestore.googleapis.com",
    opts = pulumi.ResourceOptions(depends_on=[wait60_seconds]))
database = gcp.firestore.Database("database",
    project=project.project_id,
    name="(default)",
    location_id="nam5",
    type="FIRESTORE_NATIVE",
    opts = pulumi.ResourceOptions(depends_on=[firestore]))
mydoc = gcp.firestore.Document("mydoc",
    project=project.project_id,
    database=database.name,
    collection="somenewcollection",
    document_id="my-doc-id",
    fields="{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}")
sub_document = gcp.firestore.Document("sub_document",
    project=project.project_id,
    database=database.name,
    collection=mydoc.path.apply(lambda path: f"{path}/subdocs"),
    document_id="bitcoinkey",
    fields="{\"something\":{\"mapValue\":{\"fields\":{\"ayo\":{\"stringValue\":\"val2\"}}}}}")
sub_sub_document = gcp.firestore.Document("sub_sub_document",
    project=project.project_id,
    database=database.name,
    collection=sub_document.path.apply(lambda path: f"{path}/subsubdocs"),
    document_id="asecret",
    fields="{\"something\":{\"mapValue\":{\"fields\":{\"secret\":{\"stringValue\":\"hithere\"}}}}}")
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/firestore"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/projects"
	"github.com/pulumi/pulumi-time/sdk/go/time"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.NewProject(ctx, "project", &organizations.ProjectArgs{
			ProjectId:      pulumi.String("project-id"),
			Name:           pulumi.String("project-id"),
			OrgId:          pulumi.String("123456789"),
			DeletionPolicy: pulumi.String("DELETE"),
		})
		if err != nil {
			return err
		}
		wait60Seconds, err := time.NewSleep(ctx, "wait_60_seconds", &time.SleepArgs{
			CreateDuration: "60s",
		}, pulumi.DependsOn([]pulumi.Resource{
			project,
		}))
		if err != nil {
			return err
		}
		firestore, err := projects.NewService(ctx, "firestore", &projects.ServiceArgs{
			Project: project.ProjectId,
			Service: pulumi.String("firestore.googleapis.com"),
		}, pulumi.DependsOn([]pulumi.Resource{
			wait60Seconds,
		}))
		if err != nil {
			return err
		}
		database, err := firestore.NewDatabase(ctx, "database", &firestore.DatabaseArgs{
			Project:    project.ProjectId,
			Name:       pulumi.String("(default)"),
			LocationId: pulumi.String("nam5"),
			Type:       pulumi.String("FIRESTORE_NATIVE"),
		}, pulumi.DependsOn([]pulumi.Resource{
			firestore,
		}))
		if err != nil {
			return err
		}
		mydoc, err := firestore.NewDocument(ctx, "mydoc", &firestore.DocumentArgs{
			Project:    project.ProjectId,
			Database:   database.Name,
			Collection: pulumi.String("somenewcollection"),
			DocumentId: pulumi.String("my-doc-id"),
			Fields:     pulumi.String("{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}"),
		})
		if err != nil {
			return err
		}
		subDocument, err := firestore.NewDocument(ctx, "sub_document", &firestore.DocumentArgs{
			Project:  project.ProjectId,
			Database: database.Name,
			Collection: mydoc.Path.ApplyT(func(path string) (string, error) {
				return fmt.Sprintf("%v/subdocs", path), nil
			}).(pulumi.StringOutput),
			DocumentId: pulumi.String("bitcoinkey"),
			Fields:     pulumi.String("{\"something\":{\"mapValue\":{\"fields\":{\"ayo\":{\"stringValue\":\"val2\"}}}}}"),
		})
		if err != nil {
			return err
		}
		_, err = firestore.NewDocument(ctx, "sub_sub_document", &firestore.DocumentArgs{
			Project:  project.ProjectId,
			Database: database.Name,
			Collection: subDocument.Path.ApplyT(func(path string) (string, error) {
				return fmt.Sprintf("%v/subsubdocs", path), nil
			}).(pulumi.StringOutput),
			DocumentId: pulumi.String("asecret"),
			Fields:     pulumi.String("{\"something\":{\"mapValue\":{\"fields\":{\"secret\":{\"stringValue\":\"hithere\"}}}}}"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Time = Pulumi.Time;

return await Deployment.RunAsync(() => 
{
    var project = new Gcp.Organizations.Project("project", new()
    {
        ProjectId = "project-id",
        Name = "project-id",
        OrgId = "123456789",
        DeletionPolicy = "DELETE",
    });

    var wait60Seconds = new Time.Index.Sleep("wait_60_seconds", new()
    {
        CreateDuration = "60s",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            project,
        },
    });

    var firestore = new Gcp.Projects.Service("firestore", new()
    {
        Project = project.ProjectId,
        ServiceName = "firestore.googleapis.com",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            wait60Seconds,
        },
    });

    var database = new Gcp.Firestore.Database("database", new()
    {
        Project = project.ProjectId,
        Name = "(default)",
        LocationId = "nam5",
        Type = "FIRESTORE_NATIVE",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            firestore,
        },
    });

    var mydoc = new Gcp.Firestore.Document("mydoc", new()
    {
        Project = project.ProjectId,
        Database = database.Name,
        Collection = "somenewcollection",
        DocumentId = "my-doc-id",
        Fields = "{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}",
    });

    var subDocument = new Gcp.Firestore.Document("sub_document", new()
    {
        Project = project.ProjectId,
        Database = database.Name,
        Collection = mydoc.Path.Apply(path => $"{path}/subdocs"),
        DocumentId = "bitcoinkey",
        Fields = "{\"something\":{\"mapValue\":{\"fields\":{\"ayo\":{\"stringValue\":\"val2\"}}}}}",
    });

    var subSubDocument = new Gcp.Firestore.Document("sub_sub_document", new()
    {
        Project = project.ProjectId,
        Database = database.Name,
        Collection = subDocument.Path.Apply(path => $"{path}/subsubdocs"),
        DocumentId = "asecret",
        Fields = "{\"something\":{\"mapValue\":{\"fields\":{\"secret\":{\"stringValue\":\"hithere\"}}}}}",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
import com.pulumi.time.sleep;
import com.pulumi.time.sleepArgs;
import com.pulumi.gcp.projects.Service;
import com.pulumi.gcp.projects.ServiceArgs;
import com.pulumi.gcp.firestore.Database;
import com.pulumi.gcp.firestore.DatabaseArgs;
import com.pulumi.gcp.firestore.Document;
import com.pulumi.gcp.firestore.DocumentArgs;
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 project = new Project("project", ProjectArgs.builder()
            .projectId("project-id")
            .name("project-id")
            .orgId("123456789")
            .deletionPolicy("DELETE")
            .build());

        var wait60Seconds = new Sleep("wait60Seconds", SleepArgs.builder()
            .createDuration("60s")
            .build(), CustomResourceOptions.builder()
                .dependsOn(List.of(project))
                .build());

        var firestore = new Service("firestore", ServiceArgs.builder()
            .project(project.projectId())
            .service("firestore.googleapis.com")
            .build(), CustomResourceOptions.builder()
                .dependsOn(wait60Seconds)
                .build());

        var database = new Database("database", DatabaseArgs.builder()
            .project(project.projectId())
            .name("(default)")
            .locationId("nam5")
            .type("FIRESTORE_NATIVE")
            .build(), CustomResourceOptions.builder()
                .dependsOn(firestore)
                .build());

        var mydoc = new Document("mydoc", DocumentArgs.builder()
            .project(project.projectId())
            .database(database.name())
            .collection("somenewcollection")
            .documentId("my-doc-id")
            .fields("{\"something\":{\"mapValue\":{\"fields\":{\"akey\":{\"stringValue\":\"avalue\"}}}}}")
            .build());

        var subDocument = new Document("subDocument", DocumentArgs.builder()
            .project(project.projectId())
            .database(database.name())
            .collection(mydoc.path().applyValue(_path -> String.format("%s/subdocs", _path)))
            .documentId("bitcoinkey")
            .fields("{\"something\":{\"mapValue\":{\"fields\":{\"ayo\":{\"stringValue\":\"val2\"}}}}}")
            .build());

        var subSubDocument = new Document("subSubDocument", DocumentArgs.builder()
            .project(project.projectId())
            .database(database.name())
            .collection(subDocument.path().applyValue(_path -> String.format("%s/subsubdocs", _path)))
            .documentId("asecret")
            .fields("{\"something\":{\"mapValue\":{\"fields\":{\"secret\":{\"stringValue\":\"hithere\"}}}}}")
            .build());

    }
}
Copy
resources:
  project:
    type: gcp:organizations:Project
    properties:
      projectId: project-id
      name: project-id
      orgId: '123456789'
      deletionPolicy: DELETE
  wait60Seconds:
    type: time:sleep
    name: wait_60_seconds
    properties:
      createDuration: 60s
    options:
      dependsOn:
        - ${project}
  firestore:
    type: gcp:projects:Service
    properties:
      project: ${project.projectId}
      service: firestore.googleapis.com
    options:
      dependsOn:
        - ${wait60Seconds}
  database:
    type: gcp:firestore:Database
    properties:
      project: ${project.projectId}
      name: (default)
      locationId: nam5
      type: FIRESTORE_NATIVE
    options:
      dependsOn:
        - ${firestore}
  mydoc:
    type: gcp:firestore:Document
    properties:
      project: ${project.projectId}
      database: ${database.name}
      collection: somenewcollection
      documentId: my-doc-id
      fields: '{"something":{"mapValue":{"fields":{"akey":{"stringValue":"avalue"}}}}}'
  subDocument:
    type: gcp:firestore:Document
    name: sub_document
    properties:
      project: ${project.projectId}
      database: ${database.name}
      collection: ${mydoc.path}/subdocs
      documentId: bitcoinkey
      fields: '{"something":{"mapValue":{"fields":{"ayo":{"stringValue":"val2"}}}}}'
  subSubDocument:
    type: gcp:firestore:Document
    name: sub_sub_document
    properties:
      project: ${project.projectId}
      database: ${database.name}
      collection: ${subDocument.path}/subsubdocs
      documentId: asecret
      fields: '{"something":{"mapValue":{"fields":{"secret":{"stringValue":"hithere"}}}}}'
Copy

Create Document Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Document(name: string, args: DocumentArgs, opts?: CustomResourceOptions);
@overload
def Document(resource_name: str,
             args: DocumentArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def Document(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             collection: Optional[str] = None,
             document_id: Optional[str] = None,
             fields: Optional[str] = None,
             database: Optional[str] = None,
             project: Optional[str] = None)
func NewDocument(ctx *Context, name string, args DocumentArgs, opts ...ResourceOption) (*Document, error)
public Document(string name, DocumentArgs args, CustomResourceOptions? opts = null)
public Document(String name, DocumentArgs args)
public Document(String name, DocumentArgs args, CustomResourceOptions options)
type: gcp:firestore:Document
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. DocumentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. DocumentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. DocumentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. DocumentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. DocumentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var documentResource = new Gcp.Firestore.Document("documentResource", new()
{
    Collection = "string",
    DocumentId = "string",
    Fields = "string",
    Database = "string",
    Project = "string",
});
Copy
example, err := firestore.NewDocument(ctx, "documentResource", &firestore.DocumentArgs{
	Collection: pulumi.String("string"),
	DocumentId: pulumi.String("string"),
	Fields:     pulumi.String("string"),
	Database:   pulumi.String("string"),
	Project:    pulumi.String("string"),
})
Copy
var documentResource = new Document("documentResource", DocumentArgs.builder()
    .collection("string")
    .documentId("string")
    .fields("string")
    .database("string")
    .project("string")
    .build());
Copy
document_resource = gcp.firestore.Document("documentResource",
    collection="string",
    document_id="string",
    fields="string",
    database="string",
    project="string")
Copy
const documentResource = new gcp.firestore.Document("documentResource", {
    collection: "string",
    documentId: "string",
    fields: "string",
    database: "string",
    project: "string",
});
Copy
type: gcp:firestore:Document
properties:
    collection: string
    database: string
    documentId: string
    fields: string
    project: string
Copy

Document Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Document resource accepts the following input properties:

Collection
This property is required.
Changes to this property will trigger replacement.
string
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
DocumentId
This property is required.
Changes to this property will trigger replacement.
string
The client-assigned document ID to use for this document during creation.


Fields This property is required. string
The document's fields formated as a json string.
Database Changes to this property will trigger replacement. string
The Firestore database id. Defaults to "(default)".
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Collection
This property is required.
Changes to this property will trigger replacement.
string
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
DocumentId
This property is required.
Changes to this property will trigger replacement.
string
The client-assigned document ID to use for this document during creation.


Fields This property is required. string
The document's fields formated as a json string.
Database Changes to this property will trigger replacement. string
The Firestore database id. Defaults to "(default)".
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
collection
This property is required.
Changes to this property will trigger replacement.
String
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
documentId
This property is required.
Changes to this property will trigger replacement.
String
The client-assigned document ID to use for this document during creation.


fields This property is required. String
The document's fields formated as a json string.
database Changes to this property will trigger replacement. String
The Firestore database id. Defaults to "(default)".
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
collection
This property is required.
Changes to this property will trigger replacement.
string
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
documentId
This property is required.
Changes to this property will trigger replacement.
string
The client-assigned document ID to use for this document during creation.


fields This property is required. string
The document's fields formated as a json string.
database Changes to this property will trigger replacement. string
The Firestore database id. Defaults to "(default)".
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
collection
This property is required.
Changes to this property will trigger replacement.
str
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
document_id
This property is required.
Changes to this property will trigger replacement.
str
The client-assigned document ID to use for this document during creation.


fields This property is required. str
The document's fields formated as a json string.
database Changes to this property will trigger replacement. str
The Firestore database id. Defaults to "(default)".
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
collection
This property is required.
Changes to this property will trigger replacement.
String
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
documentId
This property is required.
Changes to this property will trigger replacement.
String
The client-assigned document ID to use for this document during creation.


fields This property is required. String
The document's fields formated as a json string.
database Changes to this property will trigger replacement. String
The Firestore database id. Defaults to "(default)".
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Outputs

All input properties are implicitly available as output properties. Additionally, the Document resource produces the following output properties:

CreateTime string
Creation timestamp in RFC3339 format.
Id string
The provider-assigned unique ID for this managed resource.
Name string
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
Path string
A relative path to the collection this document exists within
UpdateTime string
Last update timestamp in RFC3339 format.
CreateTime string
Creation timestamp in RFC3339 format.
Id string
The provider-assigned unique ID for this managed resource.
Name string
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
Path string
A relative path to the collection this document exists within
UpdateTime string
Last update timestamp in RFC3339 format.
createTime String
Creation timestamp in RFC3339 format.
id String
The provider-assigned unique ID for this managed resource.
name String
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
path String
A relative path to the collection this document exists within
updateTime String
Last update timestamp in RFC3339 format.
createTime string
Creation timestamp in RFC3339 format.
id string
The provider-assigned unique ID for this managed resource.
name string
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
path string
A relative path to the collection this document exists within
updateTime string
Last update timestamp in RFC3339 format.
create_time str
Creation timestamp in RFC3339 format.
id str
The provider-assigned unique ID for this managed resource.
name str
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
path str
A relative path to the collection this document exists within
update_time str
Last update timestamp in RFC3339 format.
createTime String
Creation timestamp in RFC3339 format.
id String
The provider-assigned unique ID for this managed resource.
name String
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
path String
A relative path to the collection this document exists within
updateTime String
Last update timestamp in RFC3339 format.

Look up Existing Document Resource

Get an existing Document resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: DocumentState, opts?: CustomResourceOptions): Document
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        collection: Optional[str] = None,
        create_time: Optional[str] = None,
        database: Optional[str] = None,
        document_id: Optional[str] = None,
        fields: Optional[str] = None,
        name: Optional[str] = None,
        path: Optional[str] = None,
        project: Optional[str] = None,
        update_time: Optional[str] = None) -> Document
func GetDocument(ctx *Context, name string, id IDInput, state *DocumentState, opts ...ResourceOption) (*Document, error)
public static Document Get(string name, Input<string> id, DocumentState? state, CustomResourceOptions? opts = null)
public static Document get(String name, Output<String> id, DocumentState state, CustomResourceOptions options)
resources:  _:    type: gcp:firestore:Document    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Collection Changes to this property will trigger replacement. string
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
CreateTime string
Creation timestamp in RFC3339 format.
Database Changes to this property will trigger replacement. string
The Firestore database id. Defaults to "(default)".
DocumentId Changes to this property will trigger replacement. string
The client-assigned document ID to use for this document during creation.


Fields string
The document's fields formated as a json string.
Name string
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
Path string
A relative path to the collection this document exists within
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
UpdateTime string
Last update timestamp in RFC3339 format.
Collection Changes to this property will trigger replacement. string
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
CreateTime string
Creation timestamp in RFC3339 format.
Database Changes to this property will trigger replacement. string
The Firestore database id. Defaults to "(default)".
DocumentId Changes to this property will trigger replacement. string
The client-assigned document ID to use for this document during creation.


Fields string
The document's fields formated as a json string.
Name string
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
Path string
A relative path to the collection this document exists within
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
UpdateTime string
Last update timestamp in RFC3339 format.
collection Changes to this property will trigger replacement. String
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
createTime String
Creation timestamp in RFC3339 format.
database Changes to this property will trigger replacement. String
The Firestore database id. Defaults to "(default)".
documentId Changes to this property will trigger replacement. String
The client-assigned document ID to use for this document during creation.


fields String
The document's fields formated as a json string.
name String
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
path String
A relative path to the collection this document exists within
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
updateTime String
Last update timestamp in RFC3339 format.
collection Changes to this property will trigger replacement. string
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
createTime string
Creation timestamp in RFC3339 format.
database Changes to this property will trigger replacement. string
The Firestore database id. Defaults to "(default)".
documentId Changes to this property will trigger replacement. string
The client-assigned document ID to use for this document during creation.


fields string
The document's fields formated as a json string.
name string
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
path string
A relative path to the collection this document exists within
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
updateTime string
Last update timestamp in RFC3339 format.
collection Changes to this property will trigger replacement. str
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
create_time str
Creation timestamp in RFC3339 format.
database Changes to this property will trigger replacement. str
The Firestore database id. Defaults to "(default)".
document_id Changes to this property will trigger replacement. str
The client-assigned document ID to use for this document during creation.


fields str
The document's fields formated as a json string.
name str
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
path str
A relative path to the collection this document exists within
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
update_time str
Last update timestamp in RFC3339 format.
collection Changes to this property will trigger replacement. String
The collection ID, relative to database. For example: chatrooms or chatrooms/my-document/private-messages.
createTime String
Creation timestamp in RFC3339 format.
database Changes to this property will trigger replacement. String
The Firestore database id. Defaults to "(default)".
documentId Changes to this property will trigger replacement. String
The client-assigned document ID to use for this document during creation.


fields String
The document's fields formated as a json string.
name String
A server defined name for this document. Format: projects/{{project_id}}/databases/{{database_id}}/documents/{{path}}/{{document_id}}
path String
A relative path to the collection this document exists within
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
updateTime String
Last update timestamp in RFC3339 format.

Import

Document can be imported using any of these accepted formats:

  • {{name}}

When using the pulumi import command, Document can be imported using one of the formats above. For example:

$ pulumi import gcp:firestore/document:Document default {{name}}
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.