1. Packages
  2. Packages
  3. Ionoscloud
  4. API Docs
  5. objectstorage
  6. getBucketPolicy
Viewing docs for IonosCloud v0.3.0
published on Wednesday, Apr 15, 2026 by ionos-cloud
ionoscloud logo
Viewing docs for IonosCloud v0.3.0
published on Wednesday, Apr 15, 2026 by ionos-cloud

    The Bucket Policy data source can be used to search for and return existing bucket policies. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

    ⚠️ Note: The Terraform provider only supports contract-owned buckets. User-owned buckets are not supported, and there are no plans to introduce support for them. As a result, user-owned buckets cannot be created, updated, deleted, read, or imported using this provider.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@ionos-cloud/sdk-pulumi";
    
    const example = ionoscloud.objectstorage.getBucketPolicy({
        bucket: "example",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.objectstorage.get_bucket_policy(bucket="example")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/objectstorage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := objectstorage.LookupBucketPolicy(ctx, &objectstorage.LookupBucketPolicyArgs{
    			Bucket: "example",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Objectstorage.GetBucketPolicy.Invoke(new()
        {
            Bucket = "example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.objectstorage.ObjectstorageFunctions;
    import com.pulumi.ionoscloud.objectstorage.inputs.GetBucketPolicyArgs;
    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 example = ObjectstorageFunctions.getBucketPolicy(GetBucketPolicyArgs.builder()
                .bucket("example")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:objectstorage:getBucketPolicy
          arguments:
            bucket: example
    
    Example coming soon!
    

    Using getBucketPolicy

    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 getBucketPolicy(args: GetBucketPolicyArgs, opts?: InvokeOptions): Promise<GetBucketPolicyResult>
    function getBucketPolicyOutput(args: GetBucketPolicyOutputArgs, opts?: InvokeOptions): Output<GetBucketPolicyResult>
    def get_bucket_policy(bucket: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetBucketPolicyResult
    def get_bucket_policy_output(bucket: pulumi.Input[Optional[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetBucketPolicyResult]
    func LookupBucketPolicy(ctx *Context, args *LookupBucketPolicyArgs, opts ...InvokeOption) (*LookupBucketPolicyResult, error)
    func LookupBucketPolicyOutput(ctx *Context, args *LookupBucketPolicyOutputArgs, opts ...InvokeOption) LookupBucketPolicyResultOutput

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

    public static class GetBucketPolicy 
    {
        public static Task<GetBucketPolicyResult> InvokeAsync(GetBucketPolicyArgs args, InvokeOptions? opts = null)
        public static Output<GetBucketPolicyResult> Invoke(GetBucketPolicyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetBucketPolicyResult> getBucketPolicy(GetBucketPolicyArgs args, InvokeOptions options)
    public static Output<GetBucketPolicyResult> getBucketPolicy(GetBucketPolicyArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:objectstorage/getBucketPolicy:getBucketPolicy
      arguments:
        # arguments dictionary
    data "ionoscloud_objectstorage_getbucketpolicy" "name" {
        # arguments
    }

    The following arguments are supported:

    Bucket string
    [string] The name of the bucket where the object will be stored.
    Bucket string
    [string] The name of the bucket where the object will be stored.
    bucket string
    [string] The name of the bucket where the object will be stored.
    bucket String
    [string] The name of the bucket where the object will be stored.
    bucket string
    [string] The name of the bucket where the object will be stored.
    bucket str
    [string] The name of the bucket where the object will be stored.
    bucket String
    [string] The name of the bucket where the object will be stored.

    getBucketPolicy Result

    The following output properties are available:

    Bucket string
    Id string
    The provider-assigned unique ID for this managed resource.
    Policy string
    The policy of the bucket.
    Bucket string
    Id string
    The provider-assigned unique ID for this managed resource.
    Policy string
    The policy of the bucket.
    bucket string
    id string
    The provider-assigned unique ID for this managed resource.
    policy string
    The policy of the bucket.
    bucket String
    id String
    The provider-assigned unique ID for this managed resource.
    policy String
    The policy of the bucket.
    bucket string
    id string
    The provider-assigned unique ID for this managed resource.
    policy string
    The policy of the bucket.
    bucket str
    id str
    The provider-assigned unique ID for this managed resource.
    policy str
    The policy of the bucket.
    bucket String
    id String
    The provider-assigned unique ID for this managed resource.
    policy String
    The policy of the bucket.

    Package Details

    Repository
    ionoscloud ionos-cloud/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    Viewing docs for IonosCloud v0.3.0
    published on Wednesday, Apr 15, 2026 by ionos-cloud
      Try Pulumi Cloud free. Your team will thank you.