| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: DCL *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is managed by Magic Modules (https:#github.com/GoogleCloudPlatform/magic-modules) |
| # and is based on the DCL (https:#github.com/GoogleCloudPlatform/declarative-resource-client-library). |
| # Changes will need to be made to the DCL or Magic Modules instead of here. |
| # |
| # We are not currently able to accept contributions to this file. If changes |
| # are required, please file an issue at https:#github.com/hashicorp/terraform-provider-google/issues/new/choose |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Firebaserules" |
| description: |- |
| |
| --- |
| |
| # google_firebaserules_ruleset |
| |
| |
| |
| For more information, see: |
| * [Get started with Firebase Security Rules](https://firebase.google.com/docs/rules/get-started) |
| ## Example Usage - basic_ruleset |
| Creates a basic Firestore ruleset |
| ```hcl |
| 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" |
| } |
| |
| |
| ``` |
| ## Example Usage - minimal_ruleset |
| Creates a minimal Firestore ruleset |
| ```hcl |
| 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" |
| } |
| |
| |
| ``` |
| |
| ## 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 `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 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}}` |
| |
| * `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}` |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 20 minutes. |
| - `delete` - Default is 20 minutes. |
| |
| ## Import |
| |
| 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](https://developer.hashicorp.com/terraform/language/import) to import Ruleset using one of the formats above. For example: |
| |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/rulesets/{{name}}" |
| to = google_firebaserules_ruleset.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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}} |
| ``` |
| |
| |
| |