1. Packages
  2. Scaleway
  3. API Docs
  4. object
  5. getBucket
Scaleway v1.26.0 published on Friday, Mar 28, 2025 by pulumiverse

scaleway.object.getBucket

Explore with Pulumi AI

The scaleway.object.Bucket data source is used to retrieve information about an Object Storage bucket.

Refer to the Object Storage documentation for more information.

Retrieve an Object Storage bucket

The following commands allow you to:

  • retrieve a bucket by its name
  • retrieve a bucket by its ID
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumi/scaleway";
import * as scaleway from "@pulumiverse/scaleway";

const main = new scaleway.object.Bucket("main", {
    name: "bucket.test.com",
    tags: {
        foo: "bar",
    },
});
const selected = scaleway.object.getBucketOutput({
    name: main.id,
});
Copy
import pulumi
import pulumi_scaleway as scaleway
import pulumiverse_scaleway as scaleway

main = scaleway.object.Bucket("main",
    name="bucket.test.com",
    tags={
        "foo": "bar",
    })
selected = scaleway.object.get_bucket_output(name=main.id)
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/object"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		main, err := object.NewBucket(ctx, "main", &object.BucketArgs{
			Name: pulumi.String("bucket.test.com"),
			Tags: pulumi.StringMap{
				"foo": pulumi.String("bar"),
			},
		})
		if err != nil {
			return err
		}
		_ = object.LookupBucketOutput(ctx, object.GetBucketOutputArgs{
			Name: main.ID(),
		}, nil)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumi.Scaleway;
using Scaleway = Pulumiverse.Scaleway;

return await Deployment.RunAsync(() => 
{
    var main = new Scaleway.Object.Bucket("main", new()
    {
        Name = "bucket.test.com",
        Tags = 
        {
            { "foo", "bar" },
        },
    });

    var selected = Scaleway.Object.GetBucket.Invoke(new()
    {
        Name = main.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.object.Bucket;
import com.pulumi.scaleway.object.BucketArgs;
import com.pulumi.scaleway.object.ObjectFunctions;
import com.pulumi.scaleway.object.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) {
        var main = new Bucket("main", BucketArgs.builder()
            .name("bucket.test.com")
            .tags(Map.of("foo", "bar"))
            .build());

        final var selected = ObjectFunctions.getBucket(GetBucketArgs.builder()
            .name(main.id())
            .build());

    }
}
Copy
resources:
  main:
    type: scaleway:object:Bucket
    properties:
      name: bucket.test.com
      tags:
        foo: bar
variables:
  selected:
    fn::invoke:
      function: scaleway:object:getBucket
      arguments:
        name: ${main.id}
Copy

Retrieve a bucket from a specific project

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

const selected = scaleway.object.getBucket({
    name: "bucket.test.com",
    projectId: "11111111-1111-1111-1111-111111111111",
});
Copy
import pulumi
import pulumi_scaleway as scaleway

selected = scaleway.object.get_bucket(name="bucket.test.com",
    project_id="11111111-1111-1111-1111-111111111111")
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/object"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := object.LookupBucket(ctx, &object.LookupBucketArgs{
			Name:      pulumi.StringRef("bucket.test.com"),
			ProjectId: pulumi.StringRef("11111111-1111-1111-1111-111111111111"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumi.Scaleway;

return await Deployment.RunAsync(() => 
{
    var selected = Scaleway.Object.GetBucket.Invoke(new()
    {
        Name = "bucket.test.com",
        ProjectId = "11111111-1111-1111-1111-111111111111",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.object.ObjectFunctions;
import com.pulumi.scaleway.object.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 selected = ObjectFunctions.getBucket(GetBucketArgs.builder()
            .name("bucket.test.com")
            .projectId("11111111-1111-1111-1111-111111111111")
            .build());

    }
}
Copy
variables:
  selected:
    fn::invoke:
      function: scaleway:object:getBucket
      arguments:
        name: bucket.test.com
        projectId: 11111111-1111-1111-1111-111111111111
Copy

Using getBucket

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getBucket(args: GetBucketArgs, opts?: InvokeOptions): Promise<GetBucketResult>
function getBucketOutput(args: GetBucketOutputArgs, opts?: InvokeOptions): Output<GetBucketResult>
Copy
def get_bucket(name: Optional[str] = None,
               project_id: Optional[str] = None,
               region: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetBucketResult
def get_bucket_output(name: Optional[pulumi.Input[str]] = None,
               project_id: Optional[pulumi.Input[str]] = None,
               region: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetBucketResult]
Copy
func LookupBucket(ctx *Context, args *LookupBucketArgs, opts ...InvokeOption) (*LookupBucketResult, error)
func LookupBucketOutput(ctx *Context, args *LookupBucketOutputArgs, opts ...InvokeOption) LookupBucketResultOutput
Copy

> Note: This function is named LookupBucket in the Go SDK.

public static class GetBucket 
{
    public static Task<GetBucketResult> InvokeAsync(GetBucketArgs args, InvokeOptions? opts = null)
    public static Output<GetBucketResult> Invoke(GetBucketInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetBucketResult> getBucket(GetBucketArgs args, InvokeOptions options)
public static Output<GetBucketResult> getBucket(GetBucketArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: scaleway:object/getBucket:getBucket
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name string
ProjectId string
project_id) The ID of the project with which the bucket is associated.
Region string
region) The region in which the bucket exists.
Name string
ProjectId string
project_id) The ID of the project with which the bucket is associated.
Region string
region) The region in which the bucket exists.
name String
projectId String
project_id) The ID of the project with which the bucket is associated.
region String
region) The region in which the bucket exists.
name string
projectId string
project_id) The ID of the project with which the bucket is associated.
region string
region) The region in which the bucket exists.
name str
project_id str
project_id) The ID of the project with which the bucket is associated.
region str
region) The region in which the bucket exists.
name String
projectId String
project_id) The ID of the project with which the bucket is associated.
region String
region) The region in which the bucket exists.

getBucket Result

The following output properties are available:

Acl string
ApiEndpoint string
CorsRules []GetBucketCorsRule
Endpoint string
The endpoint URL of the bucket
ForceDestroy bool
Id string
The provider-assigned unique ID for this managed resource.
LifecycleRules []GetBucketLifecycleRule
ObjectLockEnabled bool
Tags map[string]string
Versionings []GetBucketVersioning
Name string
ProjectId string
Region string
acl String
apiEndpoint String
corsRules List<GetBucketCorsRule>
endpoint String
The endpoint URL of the bucket
forceDestroy Boolean
id String
The provider-assigned unique ID for this managed resource.
lifecycleRules List<GetBucketLifecycleRule>
objectLockEnabled Boolean
tags Map<String,String>
versionings List<GetBucketVersioning>
name String
projectId String
region String
acl string
apiEndpoint string
corsRules GetBucketCorsRule[]
endpoint string
The endpoint URL of the bucket
forceDestroy boolean
id string
The provider-assigned unique ID for this managed resource.
lifecycleRules GetBucketLifecycleRule[]
objectLockEnabled boolean
tags {[key: string]: string}
versionings GetBucketVersioning[]
name string
projectId string
region string
acl str
api_endpoint str
cors_rules Sequence[GetBucketCorsRule]
endpoint str
The endpoint URL of the bucket
force_destroy bool
id str
The provider-assigned unique ID for this managed resource.
lifecycle_rules Sequence[GetBucketLifecycleRule]
object_lock_enabled bool
tags Mapping[str, str]
versionings Sequence[GetBucketVersioning]
name str
project_id str
region str
acl String
apiEndpoint String
corsRules List<Property Map>
endpoint String
The endpoint URL of the bucket
forceDestroy Boolean
id String
The provider-assigned unique ID for this managed resource.
lifecycleRules List<Property Map>
objectLockEnabled Boolean
tags Map<String>
versionings List<Property Map>
name String
projectId String
region String

Supporting Types

GetBucketCorsRule

AllowedHeaders This property is required. List<string>
AllowedMethods This property is required. List<string>
AllowedOrigins This property is required. List<string>
ExposeHeaders This property is required. List<string>
MaxAgeSeconds This property is required. int
AllowedHeaders This property is required. []string
AllowedMethods This property is required. []string
AllowedOrigins This property is required. []string
ExposeHeaders This property is required. []string
MaxAgeSeconds This property is required. int
allowedHeaders This property is required. List<String>
allowedMethods This property is required. List<String>
allowedOrigins This property is required. List<String>
exposeHeaders This property is required. List<String>
maxAgeSeconds This property is required. Integer
allowedHeaders This property is required. string[]
allowedMethods This property is required. string[]
allowedOrigins This property is required. string[]
exposeHeaders This property is required. string[]
maxAgeSeconds This property is required. number
allowed_headers This property is required. Sequence[str]
allowed_methods This property is required. Sequence[str]
allowed_origins This property is required. Sequence[str]
expose_headers This property is required. Sequence[str]
max_age_seconds This property is required. int
allowedHeaders This property is required. List<String>
allowedMethods This property is required. List<String>
allowedOrigins This property is required. List<String>
exposeHeaders This property is required. List<String>
maxAgeSeconds This property is required. Number

GetBucketLifecycleRule

AbortIncompleteMultipartUploadDays This property is required. int
Specifies the number of days after initiating a multipart upload when the multipart upload must be completed
Enabled This property is required. bool
Specifies if the configuration rule is Enabled or Disabled
Expirations This property is required. List<Pulumiverse.Scaleway.Object.Inputs.GetBucketLifecycleRuleExpiration>
Specifies a period in the object's expire
Id This property is required. string
The unique identifier of the bucket.
Prefix This property is required. string
The prefix identifying one or more objects to which the rule applies
Tags This property is required. Dictionary<string, string>
The tags associated with the bucket lifecycle
Transitions This property is required. List<Pulumiverse.Scaleway.Object.Inputs.GetBucketLifecycleRuleTransition>
Define when objects transition to another storage class
AbortIncompleteMultipartUploadDays This property is required. int
Specifies the number of days after initiating a multipart upload when the multipart upload must be completed
Enabled This property is required. bool
Specifies if the configuration rule is Enabled or Disabled
Expirations This property is required. []GetBucketLifecycleRuleExpiration
Specifies a period in the object's expire
Id This property is required. string
The unique identifier of the bucket.
Prefix This property is required. string
The prefix identifying one or more objects to which the rule applies
Tags This property is required. map[string]string
The tags associated with the bucket lifecycle
Transitions This property is required. []GetBucketLifecycleRuleTransition
Define when objects transition to another storage class
abortIncompleteMultipartUploadDays This property is required. Integer
Specifies the number of days after initiating a multipart upload when the multipart upload must be completed
enabled This property is required. Boolean
Specifies if the configuration rule is Enabled or Disabled
expirations This property is required. List<GetBucketLifecycleRuleExpiration>
Specifies a period in the object's expire
id This property is required. String
The unique identifier of the bucket.
prefix This property is required. String
The prefix identifying one or more objects to which the rule applies
tags This property is required. Map<String,String>
The tags associated with the bucket lifecycle
transitions This property is required. List<GetBucketLifecycleRuleTransition>
Define when objects transition to another storage class
abortIncompleteMultipartUploadDays This property is required. number
Specifies the number of days after initiating a multipart upload when the multipart upload must be completed
enabled This property is required. boolean
Specifies if the configuration rule is Enabled or Disabled
expirations This property is required. GetBucketLifecycleRuleExpiration[]
Specifies a period in the object's expire
id This property is required. string
The unique identifier of the bucket.
prefix This property is required. string
The prefix identifying one or more objects to which the rule applies
tags This property is required. {[key: string]: string}
The tags associated with the bucket lifecycle
transitions This property is required. GetBucketLifecycleRuleTransition[]
Define when objects transition to another storage class
abort_incomplete_multipart_upload_days This property is required. int
Specifies the number of days after initiating a multipart upload when the multipart upload must be completed
enabled This property is required. bool
Specifies if the configuration rule is Enabled or Disabled
expirations This property is required. Sequence[GetBucketLifecycleRuleExpiration]
Specifies a period in the object's expire
id This property is required. str
The unique identifier of the bucket.
prefix This property is required. str
The prefix identifying one or more objects to which the rule applies
tags This property is required. Mapping[str, str]
The tags associated with the bucket lifecycle
transitions This property is required. Sequence[GetBucketLifecycleRuleTransition]
Define when objects transition to another storage class
abortIncompleteMultipartUploadDays This property is required. Number
Specifies the number of days after initiating a multipart upload when the multipart upload must be completed
enabled This property is required. Boolean
Specifies if the configuration rule is Enabled or Disabled
expirations This property is required. List<Property Map>
Specifies a period in the object's expire
id This property is required. String
The unique identifier of the bucket.
prefix This property is required. String
The prefix identifying one or more objects to which the rule applies
tags This property is required. Map<String>
The tags associated with the bucket lifecycle
transitions This property is required. List<Property Map>
Define when objects transition to another storage class

GetBucketLifecycleRuleExpiration

Days This property is required. int
Specifies the number of days after object creation when the specific rule action takes effect
Days This property is required. int
Specifies the number of days after object creation when the specific rule action takes effect
days This property is required. Integer
Specifies the number of days after object creation when the specific rule action takes effect
days This property is required. number
Specifies the number of days after object creation when the specific rule action takes effect
days This property is required. int
Specifies the number of days after object creation when the specific rule action takes effect
days This property is required. Number
Specifies the number of days after object creation when the specific rule action takes effect

GetBucketLifecycleRuleTransition

Days This property is required. int
Specifies the number of days after object creation when the specific rule action takes effect
StorageClass This property is required. string
Specifies the Scaleway Object Storage class to which you want the object to transition
Days This property is required. int
Specifies the number of days after object creation when the specific rule action takes effect
StorageClass This property is required. string
Specifies the Scaleway Object Storage class to which you want the object to transition
days This property is required. Integer
Specifies the number of days after object creation when the specific rule action takes effect
storageClass This property is required. String
Specifies the Scaleway Object Storage class to which you want the object to transition
days This property is required. number
Specifies the number of days after object creation when the specific rule action takes effect
storageClass This property is required. string
Specifies the Scaleway Object Storage class to which you want the object to transition
days This property is required. int
Specifies the number of days after object creation when the specific rule action takes effect
storage_class This property is required. str
Specifies the Scaleway Object Storage class to which you want the object to transition
days This property is required. Number
Specifies the number of days after object creation when the specific rule action takes effect
storageClass This property is required. String
Specifies the Scaleway Object Storage class to which you want the object to transition

GetBucketVersioning

Enabled This property is required. bool
Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state
Enabled This property is required. bool
Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state
enabled This property is required. Boolean
Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state
enabled This property is required. boolean
Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state
enabled This property is required. bool
Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state
enabled This property is required. Boolean
Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state

Package Details

Repository
scaleway pulumiverse/pulumi-scaleway
License
Apache-2.0
Notes
This Pulumi package is based on the scaleway Terraform Provider.