getBucket

Gets an existing bucket in Google Cloud Storage service (GCS). See the official documentation and API.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const my-bucket = gcp.storage.getBucket({
name: "my-bucket",
});
import pulumi
import pulumi_gcp as gcp
my_bucket = gcp.storage.get_bucket(name="my-bucket")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var my_bucket = Gcp.Storage.GetBucket.Invoke(new()
{
Name = "my-bucket",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := storage.LookupBucket(ctx, &storage.LookupBucketArgs{
Name: "my-bucket",
}, nil)
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.StorageFunctions;
import com.pulumi.gcp.storage.inputs.GetBucketArgs;
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) {
final var my-bucket = StorageFunctions.getBucket(GetBucketArgs.builder()
.name("my-bucket")
.build());
}
}
variables:
my-bucket:
fn::invoke:
Function: gcp:storage:getBucket
Arguments:
name: my-bucket

Return

A collection of values returned by getBucket.

Parameters

argument

A collection of arguments for invoking getBucket.


suspend fun getBucket(name: String, project: String? = null): GetBucketResult

Return

A collection of values returned by getBucket.

Parameters

name

The name of the bucket.

project

The ID of the project in which the resource belongs. If it is not provided, the provider project is used. If no value is supplied in the configuration or through provider defaults then the data source will use the Compute API to find the project id that corresponds to the project number returned from the Storage API. Supplying a value for project doesn't influence retrieving data about the bucket but it can be used to prevent use of the Compute API. If you do provide a project value ensure that it is the correct value for that bucket; the data source will not check that the project id and project number match.

See also


suspend fun getBucket(argument: suspend GetBucketPlainArgsBuilder.() -> Unit): GetBucketResult

Return

A collection of values returned by getBucket.

Parameters

argument

Builder for com.pulumi.gcp.storage.kotlin.inputs.GetBucketPlainArgs.

See also