gcp.firebaserules.Ruleset
Explore with Pulumi AI
For more information, see:
Example Usage
Basic_ruleset
Creates a basic Firestore ruleset
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.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",
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.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")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/firebaserules"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := firebaserules.NewRuleset(ctx, "primary", &firebaserules.RulesetArgs{
			Source: &firebaserules.RulesetSourceArgs{
				Files: firebaserules.RulesetSourceFileArray{
					&firebaserules.RulesetSourceFileArgs{
						Content:     pulumi.String("service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }"),
						Name:        pulumi.String("firestore.rules"),
						Fingerprint: pulumi.String(""),
					},
				},
				Language: pulumi.String(""),
			},
			Project: pulumi.String("my-project-name"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var primary = new Gcp.Firebaserules.Ruleset("primary", new()
    {
        Source = new Gcp.Firebaserules.Inputs.RulesetSourceArgs
        {
            Files = new[]
            {
                new Gcp.Firebaserules.Inputs.RulesetSourceFileArgs
                {
                    Content = "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
                    Name = "firestore.rules",
                    Fingerprint = "",
                },
            },
            Language = "",
        },
        Project = "my-project-name",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.firebaserules.Ruleset;
import com.pulumi.gcp.firebaserules.RulesetArgs;
import com.pulumi.gcp.firebaserules.inputs.RulesetSourceArgs;
import java.util.List;
import java.util.ArrayList;
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 primary = new Ruleset("primary", RulesetArgs.builder()
            .source(RulesetSourceArgs.builder()
                .files(RulesetSourceFileArgs.builder()
                    .content("service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }")
                    .name("firestore.rules")
                    .fingerprint("")
                    .build())
                .language("")
                .build())
            .project("my-project-name")
            .build());
    }
}
resources:
  primary:
    type: gcp:firebaserules:Ruleset
    properties:
      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
Minimal_ruleset
Creates a minimal Firestore ruleset
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.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",
});
import pulumi
import pulumi_gcp as gcp
primary = gcp.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")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/firebaserules"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := firebaserules.NewRuleset(ctx, "primary", &firebaserules.RulesetArgs{
			Source: &firebaserules.RulesetSourceArgs{
				Files: firebaserules.RulesetSourceFileArray{
					&firebaserules.RulesetSourceFileArgs{
						Content: pulumi.String("service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }"),
						Name:    pulumi.String("firestore.rules"),
					},
				},
			},
			Project: pulumi.String("my-project-name"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var primary = new Gcp.Firebaserules.Ruleset("primary", new()
    {
        Source = new Gcp.Firebaserules.Inputs.RulesetSourceArgs
        {
            Files = new[]
            {
                new Gcp.Firebaserules.Inputs.RulesetSourceFileArgs
                {
                    Content = "service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }",
                    Name = "firestore.rules",
                },
            },
        },
        Project = "my-project-name",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.firebaserules.Ruleset;
import com.pulumi.gcp.firebaserules.RulesetArgs;
import com.pulumi.gcp.firebaserules.inputs.RulesetSourceArgs;
import java.util.List;
import java.util.ArrayList;
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 primary = new Ruleset("primary", RulesetArgs.builder()
            .source(RulesetSourceArgs.builder()
                .files(RulesetSourceFileArgs.builder()
                    .content("service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }")
                    .name("firestore.rules")
                    .build())
                .build())
            .project("my-project-name")
            .build());
    }
}
resources:
  primary:
    type: gcp:firebaserules:Ruleset
    properties:
      source:
        files:
          - content: 'service cloud.firestore {match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }'
            name: firestore.rules
      project: my-project-name
Create Ruleset Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Ruleset(name: string, args: RulesetArgs, opts?: CustomResourceOptions);@overload
def Ruleset(resource_name: str,
            args: RulesetArgs,
            opts: Optional[ResourceOptions] = None)
@overload
def Ruleset(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            source: Optional[RulesetSourceArgs] = None,
            project: Optional[str] = None)func NewRuleset(ctx *Context, name string, args RulesetArgs, opts ...ResourceOption) (*Ruleset, error)public Ruleset(string name, RulesetArgs args, CustomResourceOptions? opts = null)
public Ruleset(String name, RulesetArgs args)
public Ruleset(String name, RulesetArgs args, CustomResourceOptions options)
type: gcp:firebaserules:Ruleset
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RulesetArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RulesetArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RulesetArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RulesetArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RulesetArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var rulesetResource = new Gcp.Firebaserules.Ruleset("rulesetResource", new()
{
    Source = new Gcp.Firebaserules.Inputs.RulesetSourceArgs
    {
        Files = new[]
        {
            new Gcp.Firebaserules.Inputs.RulesetSourceFileArgs
            {
                Content = "string",
                Name = "string",
                Fingerprint = "string",
            },
        },
        Language = "string",
    },
    Project = "string",
});
example, err := firebaserules.NewRuleset(ctx, "rulesetResource", &firebaserules.RulesetArgs{
	Source: &firebaserules.RulesetSourceArgs{
		Files: firebaserules.RulesetSourceFileArray{
			&firebaserules.RulesetSourceFileArgs{
				Content:     pulumi.String("string"),
				Name:        pulumi.String("string"),
				Fingerprint: pulumi.String("string"),
			},
		},
		Language: pulumi.String("string"),
	},
	Project: pulumi.String("string"),
})
var rulesetResource = new Ruleset("rulesetResource", RulesetArgs.builder()
    .source(RulesetSourceArgs.builder()
        .files(RulesetSourceFileArgs.builder()
            .content("string")
            .name("string")
            .fingerprint("string")
            .build())
        .language("string")
        .build())
    .project("string")
    .build());
ruleset_resource = gcp.firebaserules.Ruleset("rulesetResource",
    source={
        "files": [{
            "content": "string",
            "name": "string",
            "fingerprint": "string",
        }],
        "language": "string",
    },
    project="string")
const rulesetResource = new gcp.firebaserules.Ruleset("rulesetResource", {
    source: {
        files: [{
            content: "string",
            name: "string",
            fingerprint: "string",
        }],
        language: "string",
    },
    project: "string",
});
type: gcp:firebaserules:Ruleset
properties:
    project: string
    source:
        files:
            - content: string
              fingerprint: string
              name: string
        language: string
Ruleset Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Ruleset resource accepts the following input properties:
- Source
RulesetSource 
- Sourcefor the- Ruleset.
- Project string
- The project for the resource
- Source
RulesetSource Args 
- Sourcefor the- Ruleset.
- Project string
- The project for the resource
- source
RulesetSource 
- Sourcefor the- Ruleset.
- project String
- The project for the resource
- source
RulesetSource 
- Sourcefor the- Ruleset.
- project string
- The project for the resource
- source
RulesetSource Args 
- Sourcefor the- Ruleset.
- project str
- The project for the resource
- source Property Map
- Sourcefor the- Ruleset.
- project String
- The project for the resource
Outputs
All input properties are implicitly available as output properties. Additionally, the Ruleset resource produces the following output properties:
- CreateTime string
- Output only. Time the Rulesetwas created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Metadatas
List<RulesetMetadata> 
- Output only. The metadata for this ruleset.
- Name string
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- CreateTime string
- Output only. Time the Rulesetwas created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Metadatas
[]RulesetMetadata 
- Output only. The metadata for this ruleset.
- Name string
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- createTime String
- Output only. Time the Rulesetwas created.
- id String
- The provider-assigned unique ID for this managed resource.
- metadatas
List<RulesetMetadata> 
- Output only. The metadata for this ruleset.
- name String
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- createTime string
- Output only. Time the Rulesetwas created.
- id string
- The provider-assigned unique ID for this managed resource.
- metadatas
RulesetMetadata[] 
- Output only. The metadata for this ruleset.
- name string
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- create_time str
- Output only. Time the Rulesetwas created.
- id str
- The provider-assigned unique ID for this managed resource.
- metadatas
Sequence[RulesetMetadata] 
- Output only. The metadata for this ruleset.
- name str
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- createTime String
- Output only. Time the Rulesetwas created.
- id String
- The provider-assigned unique ID for this managed resource.
- metadatas List<Property Map>
- Output only. The metadata for this ruleset.
- name String
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
Look up Existing Ruleset Resource
Get an existing Ruleset resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RulesetState, opts?: CustomResourceOptions): Ruleset@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        metadatas: Optional[Sequence[RulesetMetadataArgs]] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        source: Optional[RulesetSourceArgs] = None) -> Rulesetfunc GetRuleset(ctx *Context, name string, id IDInput, state *RulesetState, opts ...ResourceOption) (*Ruleset, error)public static Ruleset Get(string name, Input<string> id, RulesetState? state, CustomResourceOptions? opts = null)public static Ruleset get(String name, Output<String> id, RulesetState state, CustomResourceOptions options)resources:  _:    type: gcp:firebaserules:Ruleset    get:      id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- CreateTime string
- Output only. Time the Rulesetwas created.
- Metadatas
List<RulesetMetadata> 
- Output only. The metadata for this ruleset.
- Name string
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- Project string
- The project for the resource
- Source
RulesetSource 
- Sourcefor the- Ruleset.
- CreateTime string
- Output only. Time the Rulesetwas created.
- Metadatas
[]RulesetMetadata Args 
- Output only. The metadata for this ruleset.
- Name string
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- Project string
- The project for the resource
- Source
RulesetSource Args 
- Sourcefor the- Ruleset.
- createTime String
- Output only. Time the Rulesetwas created.
- metadatas
List<RulesetMetadata> 
- Output only. The metadata for this ruleset.
- name String
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- project String
- The project for the resource
- source
RulesetSource 
- Sourcefor the- Ruleset.
- createTime string
- Output only. Time the Rulesetwas created.
- metadatas
RulesetMetadata[] 
- Output only. The metadata for this ruleset.
- name string
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- project string
- The project for the resource
- source
RulesetSource 
- Sourcefor the- Ruleset.
- create_time str
- Output only. Time the Rulesetwas created.
- metadatas
Sequence[RulesetMetadata Args] 
- Output only. The metadata for this ruleset.
- name str
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- project str
- The project for the resource
- source
RulesetSource Args 
- Sourcefor the- Ruleset.
- createTime String
- Output only. Time the Rulesetwas created.
- metadatas List<Property Map>
- Output only. The metadata for this ruleset.
- name String
- Output only. Name of the Ruleset. The ruleset_id is auto generated by the service. Format:projects/{project_id}/rulesets/{ruleset_id}
- project String
- The project for the resource
- source Property Map
- Sourcefor the- Ruleset.
Supporting Types
RulesetMetadata, RulesetMetadataArgs    
- Services List<string>
- Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
- Services []string
- Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
- services List<String>
- Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
- services string[]
- Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
- services Sequence[str]
- Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
- services List<String>
- Services that this ruleset has declarations for (e.g., "cloud.firestore"). There may be 0+ of these.
RulesetSource, RulesetSourceArgs    
- Files
List<RulesetSource File> 
- Fileset constituting the- Sourcebundle.
- Language string
- Languageof the- Sourcebundle. If unspecified, the language will default to- FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
- Files
[]RulesetSource File 
- Fileset constituting the- Sourcebundle.
- Language string
- Languageof the- Sourcebundle. If unspecified, the language will default to- FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
- files
List<RulesetSource File> 
- Fileset constituting the- Sourcebundle.
- language String
- Languageof the- Sourcebundle. If unspecified, the language will default to- FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
- files
RulesetSource File[] 
- Fileset constituting the- Sourcebundle.
- language string
- Languageof the- Sourcebundle. If unspecified, the language will default to- FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
- files
Sequence[RulesetSource File] 
- Fileset constituting the- Sourcebundle.
- language str
- Languageof the- Sourcebundle. If unspecified, the language will default to- FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
- files List<Property Map>
- Fileset constituting the- Sourcebundle.
- language String
- Languageof the- Sourcebundle. If unspecified, the language will default to- FIREBASE_RULES. Possible values: LANGUAGE_UNSPECIFIED, FIREBASE_RULES, EVENT_FLOW_TRIGGERS
RulesetSourceFile, RulesetSourceFileArgs      
- Content string
- Textual Content.
- Name string
- File name.
- Fingerprint string
- Fingerprint (e.g. github sha) associated with the File.
- Content string
- Textual Content.
- Name string
- File name.
- Fingerprint string
- Fingerprint (e.g. github sha) associated with the File.
- content String
- Textual Content.
- name String
- File name.
- fingerprint String
- Fingerprint (e.g. github sha) associated with the File.
- content string
- Textual Content.
- name string
- File name.
- fingerprint string
- Fingerprint (e.g. github sha) associated with the File.
- content str
- Textual Content.
- name str
- File name.
- fingerprint str
- Fingerprint (e.g. github sha) associated with the File.
- content String
- Textual Content.
- name String
- File name.
- fingerprint String
- Fingerprint (e.g. github sha) associated with the File.
Import
Ruleset can be imported using any of these accepted formats:
- projects/{{project}}/rulesets/{{name}}
- {{project}}/{{name}}
- {{name}}
When using the pulumi import command, Ruleset can be imported using one of the formats above. For example:
$ pulumi import gcp:firebaserules/ruleset:Ruleset default projects/{{project}}/rulesets/{{name}}
$ pulumi import gcp:firebaserules/ruleset:Ruleset default {{project}}/{{name}}
$ pulumi import gcp:firebaserules/ruleset:Ruleset default {{name}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the google-betaTerraform Provider.