get Bucket
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/v8/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
A collection of arguments for invoking getBucket.
Return
A collection of values returned by getBucket.
Parameters
The name of the bucket.
The ID of the project in which the resource belongs. If it is not provided 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, and if no Compute API permissions are available or if the Compute API is disabled it defaults to the provider value. 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
Return
A collection of values returned by getBucket.
Parameters
Builder for com.pulumi.gcp.storage.kotlin.inputs.GetBucketPlainArgs.