Skip to content

massdriver-cloud/gcp-cloud-function-firestore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Massdriver

gcp-cloud-function-firestore

Release Contributors Forks Stargazers Issues MIT License

A Cloud Function triggered off of Firestore events


Design

For detailed information, check out our Operator Guide for this bundle.

Usage

Our bundles aren't intended to be used locally, outside of testing. Instead, our bundles are designed to be configured, connected, deployed and monitored in the Massdriver platform.

What are Bundles?

Bundles are the basic building blocks of infrastructure, applications, and architectures in Massdriver. Read more here.

Bundle

Params

Form input parameters for configuring a bundle for deployment.

View

Properties

  • cloud_function_configuration (object): . Cannot contain additional properties.
    • entrypoint (string): Name of the function that will be executed when the Google Cloud Function is triggered. Default: app.
    • maximum_instances (integer): The maximum number of Cloud Function instances to be running at one time. Minimum: 1. Maximum: 3000. Default: 5.
    • memory_mb (integer): The total available memory given to the Cloud Function. Default: 128.
      • Items (integer): Must be one of: [128, 256, 512, 1028, 2048, 4096].
    • minimum_instances (integer): The minimum number of Cloud Function instances to be running at one time. Minimum: 0. Maximum: 3000. Default: 0.
    • runtime (string): The language runtime to use in this Cloud Function. Default: Node.js 16.
      • Items (string): Must be one of: ['Node.js 16', 'Node.js 14', 'Python 3.9', 'Python 3.8', 'Go 1.16', 'Go 1.13', 'Java 17', 'Java 11', '.NET Core 3.1', 'Ruby 3.0', 'Ruby 2.7', 'PHP 7.4'].
  • document_path (string): The document path to trigger events off of.
  • firestore_trigger (string): The document event to trigger off of. Must be one of: ['Document Create', 'Document Update', 'Document Delete', 'Document Create, Update, or Delete'].

Examples

{
    "__name": "Firestore Document Update",
    "cloud_function_configuration": {
        "minimum_instances": 0,
        "runtime": "Node.js 16"
    },
    "document_path": "users/{username}",
    "firestore_trigger": "Document Update"
}

Connections

Connections from other bundles that this bundle depends on.

View

Properties

  • firestore (object): Configuration for authenticating with your Firestore databse. Cannot contain additional properties.

    • data (object)

      • authentication (object)
        • firebase_config (object): Firebase configuration object.
          • apiKey (string)
          • appId (string)
          • authDomain (string)
          • databaseUrl (string)
          • measurementId (string)
          • messageSenderId (string)
          • projectId (string)
          • storageBucket (string)
      • infrastructure (object): Cannot contain additional properties.
        • id (string): Firestore ID, GCP Project ID.

          Examples:

          "project-id"
          "project-gr888t"
          "p-r-o-j-e-c-t"
    • specs (object)

      • gcp (object): .
        • project (string)

        • region (string): The GCP region to provision resources in.

          Examples:

          "us-east1"
          "us-east4"
          "us-west1"
          "us-west2"
          "us-west3"
          "us-west4"
          "us-central1"
  • gcp_authentication (object): GCP Service Account. Cannot contain additional properties.

    • data (object)
      • auth_provider_x509_cert_url (string): Auth Provider x509 Certificate URL. Default: https://www.googleapis.com/oauth2/v1/certs.

        Examples:

        "https://example.com/some/path"
        "https://massdriver.cloud"
      • auth_uri (string): Auth URI. Default: https://accounts.google.com/o/oauth2/auth.

        Examples:

        "https://example.com/some/path"
        "https://massdriver.cloud"
      • client_email (string): Service Account Email.

        Examples:

        "jimmy@massdriver.cloud"
        "service-account-y@gmail.com"
      • client_id (string): .

      • client_x509_cert_url (string): Client x509 Certificate URL.

        Examples:

        "https://example.com/some/path"
        "https://massdriver.cloud"
      • private_key (string): .

      • private_key_id (string): .

      • project_id (string): .

      • token_uri (string): Token URI. Default: https://oauth2.googleapis.com/token.

        Examples:

        "https://example.com/some/path"
        "https://massdriver.cloud"
      • type (string): . Default: service_account.

    • specs (object)
      • gcp (object): .
        • project (string)

        • region (string): The GCP region to provision resources in.

          Examples:

          "us-east1"
          "us-east4"
          "us-west1"
          "us-west2"
          "us-west3"
          "us-west4"
          "us-central1"
  • subnetwork (object): A region-bound network for deploying GCP resources. Cannot contain additional properties.

    • data (object)

      • infrastructure (object)
        • cidr (string)

          Examples:

          "10.100.0.0/16"
          "192.24.12.0/22"
        • gcp_global_network_grn (string): GCP Resource Name (GRN).

          Examples:

          "projects/my-project/global/networks/my-global-network"
          "projects/my-project/regions/us-west2/subnetworks/my-subnetwork"
          "projects/my-project/topics/my-pubsub-topic"
          "projects/my-project/subscriptions/my-pubsub-subscription"
          "projects/my-project/locations/us-west2/instances/my-redis-instance"
          "projects/my-project/locations/us-west2/clusters/my-gke-cluster"
        • grn (string): GCP Resource Name (GRN).

          Examples:

          "projects/my-project/global/networks/my-global-network"
          "projects/my-project/regions/us-west2/subnetworks/my-subnetwork"
          "projects/my-project/topics/my-pubsub-topic"
          "projects/my-project/subscriptions/my-pubsub-subscription"
          "projects/my-project/locations/us-west2/instances/my-redis-instance"
          "projects/my-project/locations/us-west2/clusters/my-gke-cluster"
        • vpc_access_connector (string): GCP Resource Name (GRN).

          Examples:

          "projects/my-project/global/networks/my-global-network"
          "projects/my-project/regions/us-west2/subnetworks/my-subnetwork"
          "projects/my-project/topics/my-pubsub-topic"
          "projects/my-project/subscriptions/my-pubsub-subscription"
          "projects/my-project/locations/us-west2/instances/my-redis-instance"
          "projects/my-project/locations/us-west2/clusters/my-gke-cluster"
    • specs (object)

      • gcp (object): .
        • project (string)

        • region (string): The GCP region to provision resources in.

          Examples:

          "us-east1"
          "us-east4"
          "us-west1"
          "us-west2"
          "us-west3"
          "us-west4"
          "us-central1"

Artifacts

Resources created by this bundle that can be connected to other bundles.

View

Properties

  • cloud_function (object): GCP Cloud Function. Cannot contain additional properties.
    • data (object): Cannot contain additional properties.

      • infrastructure (object): Cloud Function infrastructure configuration. Cannot contain additional properties.

        • function_url (string): URL of Cloud Function.

          Examples:

          "https://example.com/some/path"
          "https://massdriver.cloud"
        • name (string): Name of Cloud Function.

          Examples:

          "my-cloud-function"
          "my-sql-instance"
      • security (object): GCP Security Configuration. Cannot contain additional properties.

        • iam (object): IAM Roles And Conditions. Cannot contain additional properties.
          • ^[a-z]+[a-z_]*[a-z]$ (object)
            • condition (string): GCP IAM Condition.

            • role: GCP Role.

              Examples:

              "roles/owner"
              "roles/redis.editor"
              "roles/storage.objectCreator"
              "roles/storage.legacyObjectReader"
    • specs (object)

      • gcp (object): .
        • project (string)

        • region (string): The GCP region to provision resources in.

          Examples:

          "us-east1"
          "us-east4"
          "us-west1"
          "us-west2"
          "us-west3"
          "us-west4"
          "us-central1"

Contributing

Bug Reports & Feature Requests

Did we miss something? Please submit an issue to report any bugs or request additional features.

Developing

Note: Massdriver bundles are intended to be tightly use-case scoped, intention-based, reusable pieces of IaC for use in the Massdriver platform. For this reason, major feature additions that broaden the scope of an existing bundle are likely to be rejected by the community.

Still want to get involved? First check out our contribution guidelines.

Fix or Fork

If your use-case isn't covered by this bundle, you can still get involved! Massdriver is designed to be an extensible platform. Fork this bundle, or create your own bundle from scratch!

Connect

Questions? Concerns? Adulations? We'd love to hear from you!

Please connect with us!

Email GitHub LinkedIn Twitter YouTube Reddit