BackupSchedule class

A backup schedule for a Cloud Firestore Database. This resource is owned by the database it is backing up, and is deleted along with the database. The actual backups are not though.

To get more information about BackupSchedule, see:

> Warning: This resource creates a Firestore Backup Schedule on a project that already has a Firestore database. This resource is owned by the database it is backing up, and is deleted along with the database. The actual backups are not though.

Example Usage

Firestore Backup Schedule Daily

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 daily_backup = new gcp.firestore.BackupSchedule("daily-backup", {
    project: "my-project-name",
    database: database.name,
    retention: "8467200s",
    dailyRecurrence: {},
});
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")
daily_backup = gcp.firestore.BackupSchedule("daily-backup",
    project="my-project-name",
    database=database.name,
    retention="8467200s",
    daily_recurrence={})
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 daily_backup = new Gcp.Firestore.BackupSchedule("daily-backup", new()
    {
        Project = "my-project-name",
        Database = database.Name,
        Retention = "8467200s",
        DailyRecurrence = new() { },
    });

});
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_ENABLED"),
			DeletionPolicy:        pulumi.String("DELETE"),
		})
		if err != nil {
			return err
		}
		_, err = firestore.NewBackupSchedule(ctx, "daily-backup", &firestore.BackupScheduleArgs{
			Project:         pulumi.String("my-project-name"),
			Database:        database.Name,
			Retention:       pulumi.String("8467200s"),
			DailyRecurrence: &firestore.BackupScheduleDailyRecurrenceArgs{},
		})
		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_ENABLED"
  deletion_policy         = "DELETE"
}
resource "gcp_firestore_backupschedule" "daily-backup" {
  project          = "my-project-name"
  database         = gcp_firestore_database.database.name
  retention        = "8467200s"
  daily_recurrence = {}
}
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.BackupSchedule;
import com.pulumi.gcp.firestore.BackupScheduleArgs;
import com.pulumi.gcp.firestore.inputs.BackupScheduleDailyRecurrenceArgs;
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_ENABLED")
            .deletionPolicy("DELETE")
            .build());

        var daily_backup = new BackupSchedule("daily-backup", BackupScheduleArgs.builder()
            .project("my-project-name")
            .database(database.name())
            .retention("8467200s")
            .dailyRecurrence(BackupScheduleDailyRecurrenceArgs.builder()
                .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
  daily-backup:
    type: gcp:firestore:BackupSchedule
    properties:
      project: my-project-name
      database: ${database.name}
      retention: 8467200s
      dailyRecurrence: {}

Firestore Backup Schedule Weekly

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 weekly_backup = new gcp.firestore.BackupSchedule("weekly-backup", {
    project: "my-project-name",
    database: database.name,
    retention: "8467200s",
    weeklyRecurrence: {
        day: "SUNDAY",
    },
});
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")
weekly_backup = gcp.firestore.BackupSchedule("weekly-backup",
    project="my-project-name",
    database=database.name,
    retention="8467200s",
    weekly_recurrence={
        "day": "SUNDAY",
    })
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 weekly_backup = new Gcp.Firestore.BackupSchedule("weekly-backup", new()
    {
        Project = "my-project-name",
        Database = database.Name,
        Retention = "8467200s",
        WeeklyRecurrence = new Gcp.Firestore.Inputs.BackupScheduleWeeklyRecurrenceArgs
        {
            Day = "SUNDAY",
        },
    });

});
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_ENABLED"),
			DeletionPolicy:        pulumi.String("DELETE"),
		})
		if err != nil {
			return err
		}
		_, err = firestore.NewBackupSchedule(ctx, "weekly-backup", &firestore.BackupScheduleArgs{
			Project:   pulumi.String("my-project-name"),
			Database:  database.Name,
			Retention: pulumi.String("8467200s"),
			WeeklyRecurrence: &firestore.BackupScheduleWeeklyRecurrenceArgs{
				Day: pulumi.String("SUNDAY"),
			},
		})
		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_ENABLED"
  deletion_policy         = "DELETE"
}
resource "gcp_firestore_backupschedule" "weekly-backup" {
  project   = "my-project-name"
  database  = gcp_firestore_database.database.name
  retention = "8467200s"
  weekly_recurrence = {
    day = "SUNDAY"
  }
}
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.BackupSchedule;
import com.pulumi.gcp.firestore.BackupScheduleArgs;
import com.pulumi.gcp.firestore.inputs.BackupScheduleWeeklyRecurrenceArgs;
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_ENABLED")
            .deletionPolicy("DELETE")
            .build());

        var weekly_backup = new BackupSchedule("weekly-backup", BackupScheduleArgs.builder()
            .project("my-project-name")
            .database(database.name())
            .retention("8467200s")
            .weeklyRecurrence(BackupScheduleWeeklyRecurrenceArgs.builder()
                .day("SUNDAY")
                .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
  weekly-backup:
    type: gcp:firestore:BackupSchedule
    properties:
      project: my-project-name
      database: ${database.name}
      retention: 8467200s
      weeklyRecurrence:
        day: SUNDAY

Import

BackupSchedule can be imported using any of these accepted formats:

  • projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}
  • {{project}}/{{database}}/{{name}}
  • {{database}}/{{name}}

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

$ pulumi import gcp:firestore/backupSchedule:BackupSchedule default projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}
$ pulumi import gcp:firestore/backupSchedule:BackupSchedule default {{project}}/{{database}}/{{name}}
$ pulumi import gcp:firestore/backupSchedule:BackupSchedule default {{database}}/{{name}}

Constructors

BackupSchedule(String name, {BackupScheduleArgs? args, CustomResourceOptions? options})
Creates a new BackupSchedule. name The Pulumi resource name. args Arguments used to configure this BackupSchedule. The set of arguments for BackupSchedule. options Resource options controlling this resource's behavior.
BackupSchedule.reference(String urn)
Creates a typed reference to an existing BackupSchedule resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
dailyRecurrence ↔ Output<Map<String, dynamic>?>
For a schedule that runs daily.
latefinal
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
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
name ↔ Output<String>
The unique backup schedule identifier across all locations and databases for the given project. Format: projects/{{project}}/databases/{{database}}/backupSchedules/{{backupSchedule}}
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
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
retention ↔ Output<String>
At what relative time in the future, compared to its creation time, the backup should be deleted, e.g. keep backups for 7 days. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s". You can set this to a value up to 14 weeks.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
weeklyRecurrence ↔ Output<BackupScheduleWeeklyRecurrence?>
For a schedule that runs weekly on a specific day. Structure is documented below.
latefinal

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

Static Methods

get(String name, Input<String> id, {BackupScheduleState? state, CustomResourceOptions? options}) → BackupSchedule
Gets an existing BackupSchedule resource's state with the given name and id.