Skip to content

googleFirebaserulesRuleset

For more information, see:

Example Usage - basic_ruleset

Creates a basic Firestore ruleset

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.firebaserulesRuleset.FirebaserulesRuleset(this, "primary", {
  project: "my-project-name",
  source: [
    {
      files: [
        {
          content:
            "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
          fingerprint: "",
          name: "firestore.rules",
        },
      ],
      language: "",
    },
  ],
});

Example Usage - minimal_ruleset

Creates a minimal Firestore ruleset

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.firebaserulesRuleset.FirebaserulesRuleset(this, "primary", {
  project: "my-project-name",
  source: [
    {
      files: [
        {
          content:
            "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
          name: "firestore.rules",
        },
      ],
    },
  ],
});

Argument Reference

The following arguments are supported:

  • source - (Required) source for the ruleset.

The source block supports:

  • files - (Required) file set constituting the source bundle.

  • language - (Optional) language of the source bundle. If unspecified, the language will default to firebaseRules. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS

The files block supports:

  • content - (Required) Textual Content.

  • fingerprint - (Optional) Fingerprint (e.g. github sha) associated with the file.

  • name - (Required) File name.


  • project - (Optional) The project for the resource

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/rulesets/{{name}}

  • createTime - Output only. Time the ruleset was created.

  • metadata - Output only. The metadata for this ruleset.

  • name - Output only. Name of the ruleset. The ruleset_id is auto generated by the service. Format: projects/{projectId}/rulesets/{rulesetId}

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Ruleset can be imported using any of these accepted formats:

$ terraform import google_firebaserules_ruleset.default projects/{{project}}/rulesets/{{name}}
$ terraform import google_firebaserules_ruleset.default {{project}}/{{name}}
$ terraform import google_firebaserules_ruleset.default {{name}}