For more information, see:
Creates a basic Firestore ruleset
resource "google_firebaserules_ruleset" "primary" {
source {
files {
content = "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }"
name = "firestore.rules"
fingerprint = ""
}
language = ""
}
project = "my-project-name"
}
Creates a minimal Firestore ruleset
resource "google_firebaserules_ruleset" "primary" {
source {
files {
content = "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }"
name = "firestore.rules"
}
}
project = "my-project-name"
}
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 FIREBASE_RULES
. 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 resourceIn addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/rulesets/{{name}}
create_time
-
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/{project_id}/rulesets/{ruleset_id}
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.delete
- Default is 20 minutes.Ruleset can be imported using any of these accepted formats:
projects/{{project}}/rulesets/{{name}}
{{project}}/{{name}}
{{name}}
In Terraform v1.5.0 and later, use an import
block to import Ruleset using one of the formats above. For example:
import {
id = "projects/{{project}}/rulesets/{{name}}"
to = google_firebaserules_ruleset.default
}
When using the terraform import
command, Ruleset can be imported using one of the formats above. For example:
$ 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}}