published on Monday, May 18, 2026 by Pulumi
published on Monday, May 18, 2026 by Pulumi
Bucket access policies allow you to define precise, S3-compatible access control for one bucket. These are optional, and are evaluated after organization access policies. See Manage Bucket Policies for examples and further information.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as coreweave from "@pulumi/coreweave";
const raw = new coreweave.ObjectStorageBucket("raw", {
name: "bucket-policy-raw-example",
zone: "US-EAST-04A",
});
const bucketPolicy = {
version: "2012-10-17",
statement: [{
sid: "allow-all",
effect: "Allow",
principal: {
CW: "*",
},
action: ["s3:*"],
resource: [pulumi.interpolate`arn:aws:s3:::${raw.name}`],
}],
};
const rawObjectStorageBucketPolicy = new coreweave.ObjectStorageBucketPolicy("raw", {
bucket: raw.name,
policy: pulumi.jsonStringify(bucketPolicy),
});
//# Example using the coreweave_object_storage_bucket_policy_document data source
const docObjectStorageBucket = new coreweave.ObjectStorageBucket("doc", {
name: "bucket-policy-doc-example",
zone: "US-EAST-04A",
});
const doc = coreweave.getObjectStorageBucketPolicyDocumentOutput({
version: "2012-10-17",
statements: [
{
sid: "allow-all",
effect: "Allow",
actions: ["s3:*"],
resources: [pulumi.interpolate`arn:aws:s3:::${docObjectStorageBucket.name}`],
principal: {
CW: ["*"],
},
},
{
sid: "DenyIfPrefixEquals",
effect: "Deny",
actions: ["s3:ListBucket"],
resources: [pulumi.interpolate`arn:aws:s3:::${docObjectStorageBucket.name}`],
principal: {
CW: ["*"],
},
condition: {
StringNotEquals: {
"s3:prefix": "projects",
},
},
},
],
});
const docObjectStorageBucketPolicy = new coreweave.ObjectStorageBucketPolicy("doc", {
bucket: docObjectStorageBucket.name,
policy: doc.apply(doc => doc.json),
});
import pulumi
import json
import pulumi_coreweave as coreweave
raw = coreweave.ObjectStorageBucket("raw",
name="bucket-policy-raw-example",
zone="US-EAST-04A")
bucket_policy = {
"version": "2012-10-17",
"statement": [{
"sid": "allow-all",
"effect": "Allow",
"principal": {
"CW": "*",
},
"action": ["s3:*"],
"resource": [raw.name.apply(lambda name: f"arn:aws:s3:::{name}")],
}],
}
raw_object_storage_bucket_policy = coreweave.ObjectStorageBucketPolicy("raw",
bucket=raw.name,
policy=pulumi.Output.json_dumps(bucket_policy))
## Example using the coreweave_object_storage_bucket_policy_document data source
doc_object_storage_bucket = coreweave.ObjectStorageBucket("doc",
name="bucket-policy-doc-example",
zone="US-EAST-04A")
doc = coreweave.get_object_storage_bucket_policy_document_output(version="2012-10-17",
statements=[
{
"sid": "allow-all",
"effect": "Allow",
"actions": ["s3:*"],
"resources": [doc_object_storage_bucket.name.apply(lambda name: f"arn:aws:s3:::{name}")],
"principal": {
"CW": ["*"],
},
},
{
"sid": "DenyIfPrefixEquals",
"effect": "Deny",
"actions": ["s3:ListBucket"],
"resources": [doc_object_storage_bucket.name.apply(lambda name: f"arn:aws:s3:::{name}")],
"principal": {
"CW": ["*"],
},
"condition": {
"StringNotEquals": {
"s3:prefix": "projects",
},
},
},
])
doc_object_storage_bucket_policy = coreweave.ObjectStorageBucketPolicy("doc",
bucket=doc_object_storage_bucket.name,
policy=doc.json)
package main
import (
"encoding/json"
"fmt"
"github.com/pulumi/pulumi-coreweave/sdk/go/coreweave"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
raw, err := coreweave.NewObjectStorageBucket(ctx, "raw", &coreweave.ObjectStorageBucketArgs{
Name: pulumi.String("bucket-policy-raw-example"),
Zone: pulumi.String("US-EAST-04A"),
})
if err != nil {
return err
}
bucketPolicy := map[string]interface{}{
"version": "2012-10-17",
"statement": []map[string]interface{}{
map[string]interface{}{
"sid": "allow-all",
"effect": "Allow",
"principal": map[string]interface{}{
"CW": "*",
},
"action": []string{
"s3:*",
},
"resource": pulumi.StringArray{
raw.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("arn:aws:s3:::%v", name), nil
}).(pulumi.StringOutput),
},
},
},
}
tmpJSON0, err := json.Marshal(bucketPolicy)
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = coreweave.NewObjectStorageBucketPolicy(ctx, "raw", &coreweave.ObjectStorageBucketPolicyArgs{
Bucket: raw.Name,
Policy: json0,
})
if err != nil {
return err
}
// # Example using the coreweave_object_storage_bucket_policy_document data source
docObjectStorageBucket, err := coreweave.NewObjectStorageBucket(ctx, "doc", &coreweave.ObjectStorageBucketArgs{
Name: pulumi.String("bucket-policy-doc-example"),
Zone: pulumi.String("US-EAST-04A"),
})
if err != nil {
return err
}
doc := coreweave.GetObjectStorageBucketPolicyDocumentOutput(ctx, coreweave.GetObjectStorageBucketPolicyDocumentOutputArgs{
Version: pulumi.String("2012-10-17"),
Statements: coreweave.GetObjectStorageBucketPolicyDocumentStatementArray{
&coreweave.GetObjectStorageBucketPolicyDocumentStatementArgs{
Sid: pulumi.String("allow-all"),
Effect: pulumi.String("Allow"),
Actions: pulumi.StringArray{
pulumi.String("s3:*"),
},
Resources: pulumi.StringArray{
docObjectStorageBucket.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("arn:aws:s3:::%v", name), nil
}).(pulumi.StringOutput),
},
Principal: pulumi.StringArrayMap{
"CW": pulumi.StringArray{
pulumi.String("*"),
},
},
},
&coreweave.GetObjectStorageBucketPolicyDocumentStatementArgs{
Sid: pulumi.String("DenyIfPrefixEquals"),
Effect: pulumi.String("Deny"),
Actions: pulumi.StringArray{
pulumi.String("s3:ListBucket"),
},
Resources: pulumi.StringArray{
docObjectStorageBucket.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("arn:aws:s3:::%v", name), nil
}).(pulumi.StringOutput),
},
Principal: pulumi.StringArrayMap{
"CW": pulumi.StringArray{
pulumi.String("*"),
},
},
Condition: pulumi.StringMapMap{
"StringNotEquals": pulumi.StringMap{
"s3:prefix": pulumi.String("projects"),
},
},
},
},
}, nil)
_, err = coreweave.NewObjectStorageBucketPolicy(ctx, "doc", &coreweave.ObjectStorageBucketPolicyArgs{
Bucket: docObjectStorageBucket.Name,
Policy: pulumi.String(doc.ApplyT(func(doc coreweave.GetObjectStorageBucketPolicyDocumentResult) (*string, error) {
return &doc.Json, nil
}).(pulumi.StringPtrOutput)),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using CoreWeave = Pulumi.CoreWeave;
return await Deployment.RunAsync(() =>
{
var raw = new CoreWeave.ObjectStorageBucket("raw", new()
{
Name = "bucket-policy-raw-example",
Zone = "US-EAST-04A",
});
var bucketPolicy =
{
{ "version", "2012-10-17" },
{ "statement", new[]
{
{
{ "sid", "allow-all" },
{ "effect", "Allow" },
{ "principal",
{
{ "CW", "*" },
} },
{ "action", new[]
{
"s3:*",
} },
{ "resource", new[]
{
raw.Name.Apply(name => $"arn:aws:s3:::{name}"),
} },
},
} },
};
var rawObjectStorageBucketPolicy = new CoreWeave.ObjectStorageBucketPolicy("raw", new()
{
Bucket = raw.Name,
Policy = Output.JsonSerialize(Output.Create(bucketPolicy)),
});
//# Example using the coreweave_object_storage_bucket_policy_document data source
var docObjectStorageBucket = new CoreWeave.ObjectStorageBucket("doc", new()
{
Name = "bucket-policy-doc-example",
Zone = "US-EAST-04A",
});
var doc = CoreWeave.GetObjectStorageBucketPolicyDocument.Invoke(new()
{
Version = "2012-10-17",
Statements = new[]
{
new CoreWeave.Inputs.GetObjectStorageBucketPolicyDocumentStatementInputArgs
{
Sid = "allow-all",
Effect = "Allow",
Actions = new[]
{
"s3:*",
},
Resources = new[]
{
$"arn:aws:s3:::{docObjectStorageBucket.Name}",
},
Principal =
{
{ "CW", new[]
{
"*",
} },
},
},
new CoreWeave.Inputs.GetObjectStorageBucketPolicyDocumentStatementInputArgs
{
Sid = "DenyIfPrefixEquals",
Effect = "Deny",
Actions = new[]
{
"s3:ListBucket",
},
Resources = new[]
{
$"arn:aws:s3:::{docObjectStorageBucket.Name}",
},
Principal =
{
{ "CW", new[]
{
"*",
} },
},
Condition =
{
{ "StringNotEquals",
{
{ "s3:prefix", "projects" },
} },
},
},
},
});
var docObjectStorageBucketPolicy = new CoreWeave.ObjectStorageBucketPolicy("doc", new()
{
Bucket = docObjectStorageBucket.Name,
Policy = doc.Apply(getObjectStorageBucketPolicyDocumentResult => getObjectStorageBucketPolicyDocumentResult.Json),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.coreweave.ObjectStorageBucket;
import com.pulumi.coreweave.ObjectStorageBucketArgs;
import com.pulumi.coreweave.ObjectStorageBucketPolicy;
import com.pulumi.coreweave.ObjectStorageBucketPolicyArgs;
import com.pulumi.coreweave.CoreweaveFunctions;
import com.pulumi.coreweave.inputs.GetObjectStorageBucketPolicyDocumentArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 raw = new ObjectStorageBucket("raw", ObjectStorageBucketArgs.builder()
.name("bucket-policy-raw-example")
.zone("US-EAST-04A")
.build());
final var bucketPolicy = Map.ofEntries(
Map.entry("version", "2012-10-17"),
Map.entry("statement", Map.ofEntries(
Map.entry("sid", "allow-all"),
Map.entry("effect", "Allow"),
Map.entry("principal", Map.of("CW", "*")),
Map.entry("action", "s3:*"),
Map.entry("resource", raw.name().applyValue(_name -> String.format("arn:aws:s3:::%s", _name)))
))
);
var rawObjectStorageBucketPolicy = new ObjectStorageBucketPolicy("rawObjectStorageBucketPolicy", ObjectStorageBucketPolicyArgs.builder()
.bucket(raw.name())
.policy(serializeJson(
bucketPolicy))
.build());
//# Example using the coreweave_object_storage_bucket_policy_document data source
var docObjectStorageBucket = new ObjectStorageBucket("docObjectStorageBucket", ObjectStorageBucketArgs.builder()
.name("bucket-policy-doc-example")
.zone("US-EAST-04A")
.build());
final var doc = CoreweaveFunctions.getObjectStorageBucketPolicyDocument(GetObjectStorageBucketPolicyDocumentArgs.builder()
.version("2012-10-17")
.statements(
GetObjectStorageBucketPolicyDocumentStatementArgs.builder()
.sid("allow-all")
.effect("Allow")
.actions("s3:*")
.resources(docObjectStorageBucket.name().applyValue(_name -> String.format("arn:aws:s3:::%s", _name)))
.principal(Map.of("CW", "*"))
.build(),
GetObjectStorageBucketPolicyDocumentStatementArgs.builder()
.sid("DenyIfPrefixEquals")
.effect("Deny")
.actions("s3:ListBucket")
.resources(docObjectStorageBucket.name().applyValue(_name -> String.format("arn:aws:s3:::%s", _name)))
.principal(Map.of("CW", "*"))
.condition(Map.of("StringNotEquals", Map.of("s3:prefix", "projects")))
.build())
.build());
var docObjectStorageBucketPolicy = new ObjectStorageBucketPolicy("docObjectStorageBucketPolicy", ObjectStorageBucketPolicyArgs.builder()
.bucket(docObjectStorageBucket.name())
.policy(doc.applyValue(_doc -> _doc.json()))
.build());
}
}
resources:
raw:
type: coreweave:ObjectStorageBucket
properties:
name: bucket-policy-raw-example
zone: US-EAST-04A
rawObjectStorageBucketPolicy:
type: coreweave:ObjectStorageBucketPolicy
name: raw
properties:
bucket: ${raw.name}
policy:
fn::toJSON: ${bucketPolicy}
## Example using the coreweave_object_storage_bucket_policy_document data source
docObjectStorageBucket:
type: coreweave:ObjectStorageBucket
name: doc
properties:
name: bucket-policy-doc-example
zone: US-EAST-04A
docObjectStorageBucketPolicy:
type: coreweave:ObjectStorageBucketPolicy
name: doc
properties:
bucket: ${docObjectStorageBucket.name}
policy: ${doc.json}
variables:
bucketPolicy:
version: 2012-10-17
statement:
- sid: allow-all
effect: Allow
principal:
CW: '*'
action:
- s3:*
resource:
- arn:aws:s3:::${raw.name}
doc:
fn::invoke:
function: coreweave:getObjectStorageBucketPolicyDocument
arguments:
version: 2012-10-17
statements:
- sid: allow-all
effect: Allow
actions:
- s3:*
resources:
- arn:aws:s3:::${docObjectStorageBucket.name}
principal:
CW:
- '*'
- sid: DenyIfPrefixEquals
effect: Deny
actions:
- s3:ListBucket
resources:
- arn:aws:s3:::${docObjectStorageBucket.name}
principal:
CW:
- '*'
condition:
StringNotEquals:
s3:prefix: projects
Example coming soon!
Create ObjectStorageBucketPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ObjectStorageBucketPolicy(name: string, args: ObjectStorageBucketPolicyArgs, opts?: CustomResourceOptions);@overload
def ObjectStorageBucketPolicy(resource_name: str,
args: ObjectStorageBucketPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ObjectStorageBucketPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
policy: Optional[str] = None)func NewObjectStorageBucketPolicy(ctx *Context, name string, args ObjectStorageBucketPolicyArgs, opts ...ResourceOption) (*ObjectStorageBucketPolicy, error)public ObjectStorageBucketPolicy(string name, ObjectStorageBucketPolicyArgs args, CustomResourceOptions? opts = null)
public ObjectStorageBucketPolicy(String name, ObjectStorageBucketPolicyArgs args)
public ObjectStorageBucketPolicy(String name, ObjectStorageBucketPolicyArgs args, CustomResourceOptions options)
type: coreweave:ObjectStorageBucketPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "coreweave_objectstoragebucketpolicy" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args ObjectStorageBucketPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ObjectStorageBucketPolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ObjectStorageBucketPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ObjectStorageBucketPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ObjectStorageBucketPolicyArgs
- 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 objectStorageBucketPolicyResource = new CoreWeave.ObjectStorageBucketPolicy("objectStorageBucketPolicyResource", new()
{
Bucket = "string",
Policy = "string",
});
example, err := coreweave.NewObjectStorageBucketPolicy(ctx, "objectStorageBucketPolicyResource", &coreweave.ObjectStorageBucketPolicyArgs{
Bucket: pulumi.String("string"),
Policy: pulumi.String("string"),
})
resource "coreweave_objectstoragebucketpolicy" "objectStorageBucketPolicyResource" {
bucket = "string"
policy = "string"
}
var objectStorageBucketPolicyResource = new ObjectStorageBucketPolicy("objectStorageBucketPolicyResource", ObjectStorageBucketPolicyArgs.builder()
.bucket("string")
.policy("string")
.build());
object_storage_bucket_policy_resource = coreweave.ObjectStorageBucketPolicy("objectStorageBucketPolicyResource",
bucket="string",
policy="string")
const objectStorageBucketPolicyResource = new coreweave.ObjectStorageBucketPolicy("objectStorageBucketPolicyResource", {
bucket: "string",
policy: "string",
});
type: coreweave:ObjectStorageBucketPolicy
properties:
bucket: string
policy: string
ObjectStorageBucketPolicy 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 ObjectStorageBucketPolicy resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ObjectStorageBucketPolicy resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing ObjectStorageBucketPolicy Resource
Get an existing ObjectStorageBucketPolicy 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?: ObjectStorageBucketPolicyState, opts?: CustomResourceOptions): ObjectStorageBucketPolicy@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
policy: Optional[str] = None) -> ObjectStorageBucketPolicyfunc GetObjectStorageBucketPolicy(ctx *Context, name string, id IDInput, state *ObjectStorageBucketPolicyState, opts ...ResourceOption) (*ObjectStorageBucketPolicy, error)public static ObjectStorageBucketPolicy Get(string name, Input<string> id, ObjectStorageBucketPolicyState? state, CustomResourceOptions? opts = null)public static ObjectStorageBucketPolicy get(String name, Output<String> id, ObjectStorageBucketPolicyState state, CustomResourceOptions options)resources: _: type: coreweave:ObjectStorageBucketPolicy get: id: ${id}import {
to = coreweave_objectstoragebucketpolicy.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
Import
$ pulumi import coreweave:index/objectStorageBucketPolicy:ObjectStorageBucketPolicy default {{bucket_name}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- coreweave pulumi/pulumi-coreweave
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
coreweaveTerraform Provider.
published on Monday, May 18, 2026 by Pulumi
