1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. firebase
  5. StorageBucket
Google Cloud v8.27.1 published on Friday, Apr 25, 2025 by Pulumi

gcp.firebase.StorageBucket

Explore with Pulumi AI

Example Usage

Firebasestorage Bucket Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const _default = new gcp.storage.Bucket("default", {
    name: "test_bucket",
    location: "US",
    uniformBucketLevelAccess: true,
});
const defaultStorageBucket = new gcp.firebase.StorageBucket("default", {
    project: "my-project-name",
    bucketId: _default.id,
});
Copy
import pulumi
import pulumi_gcp as gcp

default = gcp.storage.Bucket("default",
    name="test_bucket",
    location="US",
    uniform_bucket_level_access=True)
default_storage_bucket = gcp.firebase.StorageBucket("default",
    project="my-project-name",
    bucket_id=default.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/firebase"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := storage.NewBucket(ctx, "default", &storage.BucketArgs{
			Name:                     pulumi.String("test_bucket"),
			Location:                 pulumi.String("US"),
			UniformBucketLevelAccess: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = firebase.NewStorageBucket(ctx, "default", &firebase.StorageBucketArgs{
			Project:  pulumi.String("my-project-name"),
			BucketId: _default.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var @default = new Gcp.Storage.Bucket("default", new()
    {
        Name = "test_bucket",
        Location = "US",
        UniformBucketLevelAccess = true,
    });

    var defaultStorageBucket = new Gcp.Firebase.StorageBucket("default", new()
    {
        Project = "my-project-name",
        BucketId = @default.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.firebase.StorageBucket;
import com.pulumi.gcp.firebase.StorageBucketArgs;
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 default_ = new Bucket("default", BucketArgs.builder()
            .name("test_bucket")
            .location("US")
            .uniformBucketLevelAccess(true)
            .build());

        var defaultStorageBucket = new StorageBucket("defaultStorageBucket", StorageBucketArgs.builder()
            .project("my-project-name")
            .bucketId(default_.id())
            .build());

    }
}
Copy
resources:
  default:
    type: gcp:storage:Bucket
    properties:
      name: test_bucket
      location: US
      uniformBucketLevelAccess: true
  defaultStorageBucket:
    type: gcp:firebase:StorageBucket
    name: default
    properties:
      project: my-project-name
      bucketId: ${default.id}
Copy

Create StorageBucket Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new StorageBucket(name: string, args?: StorageBucketArgs, opts?: CustomResourceOptions);
@overload
def StorageBucket(resource_name: str,
                  args: Optional[StorageBucketArgs] = None,
                  opts: Optional[ResourceOptions] = None)

@overload
def StorageBucket(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  bucket_id: Optional[str] = None,
                  project: Optional[str] = None)
func NewStorageBucket(ctx *Context, name string, args *StorageBucketArgs, opts ...ResourceOption) (*StorageBucket, error)
public StorageBucket(string name, StorageBucketArgs? args = null, CustomResourceOptions? opts = null)
public StorageBucket(String name, StorageBucketArgs args)
public StorageBucket(String name, StorageBucketArgs args, CustomResourceOptions options)
type: gcp:firebase:StorageBucket
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args StorageBucketArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args StorageBucketArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args StorageBucketArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args StorageBucketArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. StorageBucketArgs
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 storageBucketResource = new Gcp.Firebase.StorageBucket("storageBucketResource", new()
{
    BucketId = "string",
    Project = "string",
});
Copy
example, err := firebase.NewStorageBucket(ctx, "storageBucketResource", &firebase.StorageBucketArgs{
	BucketId: pulumi.String("string"),
	Project:  pulumi.String("string"),
})
Copy
var storageBucketResource = new StorageBucket("storageBucketResource", StorageBucketArgs.builder()
    .bucketId("string")
    .project("string")
    .build());
Copy
storage_bucket_resource = gcp.firebase.StorageBucket("storageBucketResource",
    bucket_id="string",
    project="string")
Copy
const storageBucketResource = new gcp.firebase.StorageBucket("storageBucketResource", {
    bucketId: "string",
    project: "string",
});
Copy
type: gcp:firebase:StorageBucket
properties:
    bucketId: string
    project: string
Copy

StorageBucket 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 StorageBucket resource accepts the following input properties:

BucketId Changes to this property will trigger replacement. string
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
BucketId Changes to this property will trigger replacement. string
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
bucketId Changes to this property will trigger replacement. String
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
bucketId Changes to this property will trigger replacement. string
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
bucket_id Changes to this property will trigger replacement. str
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
bucketId Changes to this property will trigger replacement. String
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Outputs

All input properties are implicitly available as output properties. Additionally, the StorageBucket resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Name string
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
Id string
The provider-assigned unique ID for this managed resource.
Name string
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
id String
The provider-assigned unique ID for this managed resource.
name String
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
id string
The provider-assigned unique ID for this managed resource.
name string
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
id str
The provider-assigned unique ID for this managed resource.
name str
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
id String
The provider-assigned unique ID for this managed resource.
name String
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID

Look up Existing StorageBucket Resource

Get an existing StorageBucket 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?: StorageBucketState, opts?: CustomResourceOptions): StorageBucket
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bucket_id: Optional[str] = None,
        name: Optional[str] = None,
        project: Optional[str] = None) -> StorageBucket
func GetStorageBucket(ctx *Context, name string, id IDInput, state *StorageBucketState, opts ...ResourceOption) (*StorageBucket, error)
public static StorageBucket Get(string name, Input<string> id, StorageBucketState? state, CustomResourceOptions? opts = null)
public static StorageBucket get(String name, Output<String> id, StorageBucketState state, CustomResourceOptions options)
resources:  _:    type: gcp:firebase:StorageBucket    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
BucketId Changes to this property will trigger replacement. string
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
Name string
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
BucketId Changes to this property will trigger replacement. string
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
Name string
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
bucketId Changes to this property will trigger replacement. String
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
name String
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
bucketId Changes to this property will trigger replacement. string
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
name string
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
bucket_id Changes to this property will trigger replacement. str
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
name str
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
bucketId Changes to this property will trigger replacement. String
Required. Immutable. The ID of the underlying Google Cloud Storage bucket
name String
Resource name of the bucket in the format projects/PROJECT_IDENTIFIER/buckets/BUCKET_ID
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Import

Bucket can be imported using any of these accepted formats:

  • projects/{{project}}/buckets/{{bucket_id}}

  • {{project}}/{{bucket_id}}

  • {{bucket_id}}

When using the pulumi import command, Bucket can be imported using one of the formats above. For example:

$ pulumi import gcp:firebase/storageBucket:StorageBucket default projects/{{project}}/buckets/{{bucket_id}}
Copy
$ pulumi import gcp:firebase/storageBucket:StorageBucket default {{project}}/{{bucket_id}}
Copy
$ pulumi import gcp:firebase/storageBucket:StorageBucket default {{bucket_id}}
Copy

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-beta Terraform Provider.