published on Wednesday, Apr 15, 2026 by ionos-cloud
published on Wednesday, Apr 15, 2026 by ionos-cloud
Manages Buckets policies on IonosCloud.
⚠️ 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 = new ionoscloud.objectstorage.Bucket("example", {name: "example"});
const exampleBucketPolicy = new ionoscloud.objectstorage.BucketPolicy("example", {
bucket: example.name,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{
Sid: "Delegate certain actions to another user",
Action: [
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject",
],
Effect: "Allow",
Resource: [
"arn:aws:s3:::example",
"arn:aws:s3:::example/*",
],
Condition: {
IpAddress: ["123.123.123.123/32"],
},
Principal: ["arn:aws:iam:::user/31000000:9acd8251-2857-410e-b1fd-ca86462bdcec"],
}],
}),
});
import pulumi
import json
import pulumi_ionoscloud as ionoscloud
example = ionoscloud.objectstorage.Bucket("example", name="example")
example_bucket_policy = ionoscloud.objectstorage.BucketPolicy("example",
bucket=example.name,
policy=json.dumps({
"Version": "2012-10-17",
"Statement": [{
"Sid": "Delegate certain actions to another user",
"Action": [
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject",
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::example",
"arn:aws:s3:::example/*",
],
"Condition": {
"IpAddress": ["123.123.123.123/32"],
},
"Principal": ["arn:aws:iam:::user/31000000:9acd8251-2857-410e-b1fd-ca86462bdcec"],
}],
}))
package main
import (
"encoding/json"
"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 {
example, err := objectstorage.NewBucket(ctx, "example", &objectstorage.BucketArgs{
Name: pulumi.String("example"),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"Version": "2012-10-17",
"Statement": []map[string]interface{}{
map[string]interface{}{
"Sid": "Delegate certain actions to another user",
"Action": []string{
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject",
},
"Effect": "Allow",
"Resource": []string{
"arn:aws:s3:::example",
"arn:aws:s3:::example/*",
},
"Condition": map[string]interface{}{
"IpAddress": []string{
"123.123.123.123/32",
},
},
"Principal": []string{
"arn:aws:iam:::user/31000000:9acd8251-2857-410e-b1fd-ca86462bdcec",
},
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = objectstorage.NewBucketPolicy(ctx, "example", &objectstorage.BucketPolicyArgs{
Bucket: example.Name,
Policy: pulumi.String(pulumi.String(json0)),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
return await Deployment.RunAsync(() =>
{
var example = new Ionoscloud.Objectstorage.Bucket("example", new()
{
Name = "example",
});
var exampleBucketPolicy = new Ionoscloud.Objectstorage.BucketPolicy("example", new()
{
Bucket = example.Name,
Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Version"] = "2012-10-17",
["Statement"] = new[]
{
new Dictionary<string, object?>
{
["Sid"] = "Delegate certain actions to another user",
["Action"] = new[]
{
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject",
},
["Effect"] = "Allow",
["Resource"] = new[]
{
"arn:aws:s3:::example",
"arn:aws:s3:::example/*",
},
["Condition"] = new Dictionary<string, object?>
{
["IpAddress"] = new[]
{
"123.123.123.123/32",
},
},
["Principal"] = new[]
{
"arn:aws:iam:::user/31000000:9acd8251-2857-410e-b1fd-ca86462bdcec",
},
},
},
}),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.ionoscloud.pulumi.ionoscloud.objectstorage.Bucket;
import com.ionoscloud.pulumi.ionoscloud.objectstorage.BucketArgs;
import com.ionoscloud.pulumi.ionoscloud.objectstorage.BucketPolicy;
import com.ionoscloud.pulumi.ionoscloud.objectstorage.BucketPolicyArgs;
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 example = new Bucket("example", BucketArgs.builder()
.name("example")
.build());
var exampleBucketPolicy = new BucketPolicy("exampleBucketPolicy", BucketPolicyArgs.builder()
.bucket(example.name())
.policy(serializeJson(
jsonObject(
jsonProperty("Version", "2012-10-17"),
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Sid", "Delegate certain actions to another user"),
jsonProperty("Action", jsonArray(
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject"
)),
jsonProperty("Effect", "Allow"),
jsonProperty("Resource", jsonArray(
"arn:aws:s3:::example",
"arn:aws:s3:::example/*"
)),
jsonProperty("Condition", jsonObject(
jsonProperty("IpAddress", jsonArray("123.123.123.123/32"))
)),
jsonProperty("Principal", jsonArray("arn:aws:iam:::user/31000000:9acd8251-2857-410e-b1fd-ca86462bdcec"))
)))
)))
.build());
}
}
resources:
example:
type: ionoscloud:objectstorage:Bucket
properties:
name: example
exampleBucketPolicy:
type: ionoscloud:objectstorage:BucketPolicy
name: example
properties:
bucket: ${example.name}
policy:
fn::toJSON:
Version: 2012-10-17
Statement:
- Sid: Delegate certain actions to another user
Action:
- s3:ListBucket
- s3:PutObject
- s3:GetObject
Effect: Allow
Resource:
- arn:aws:s3:::example
- arn:aws:s3:::example/*
Condition:
IpAddress:
- 123.123.123.123/32
Principal:
- arn:aws:iam:::user/31000000:9acd8251-2857-410e-b1fd-ca86462bdcec
⚠️ Note: For more information about the bucket policy or the policy format, please see the IonosCloud Object Storage documentation.
Create BucketPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new BucketPolicy(name: string, args: BucketPolicyArgs, opts?: CustomResourceOptions);@overload
def BucketPolicy(resource_name: str,
args: BucketPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def BucketPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
policy: Optional[str] = None)func NewBucketPolicy(ctx *Context, name string, args BucketPolicyArgs, opts ...ResourceOption) (*BucketPolicy, error)public BucketPolicy(string name, BucketPolicyArgs args, CustomResourceOptions? opts = null)
public BucketPolicy(String name, BucketPolicyArgs args)
public BucketPolicy(String name, BucketPolicyArgs args, CustomResourceOptions options)
type: ionoscloud:objectstorage:BucketPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args BucketPolicyArgs
- 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 BucketPolicyArgs
- 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 BucketPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BucketPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BucketPolicyArgs
- 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 bucketPolicyResource = new Ionoscloud.Objectstorage.BucketPolicy("bucketPolicyResource", new()
{
Bucket = "string",
Policy = "string",
});
example, err := objectstorage.NewBucketPolicy(ctx, "bucketPolicyResource", &objectstorage.BucketPolicyArgs{
Bucket: pulumi.String("string"),
Policy: pulumi.String("string"),
})
var bucketPolicyResource = new BucketPolicy("bucketPolicyResource", BucketPolicyArgs.builder()
.bucket("string")
.policy("string")
.build());
bucket_policy_resource = ionoscloud.objectstorage.BucketPolicy("bucketPolicyResource",
bucket="string",
policy="string")
const bucketPolicyResource = new ionoscloud.objectstorage.BucketPolicy("bucketPolicyResource", {
bucket: "string",
policy: "string",
});
type: ionoscloud:objectstorage:BucketPolicy
properties:
bucket: string
policy: string
BucketPolicy 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 BucketPolicy resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the BucketPolicy 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 str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing BucketPolicy Resource
Get an existing BucketPolicy 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?: BucketPolicyState, opts?: CustomResourceOptions): BucketPolicy@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
policy: Optional[str] = None) -> BucketPolicyfunc GetBucketPolicy(ctx *Context, name string, id IDInput, state *BucketPolicyState, opts ...ResourceOption) (*BucketPolicy, error)public static BucketPolicy Get(string name, Input<string> id, BucketPolicyState? state, CustomResourceOptions? opts = null)public static BucketPolicy get(String name, Output<String> id, BucketPolicyState state, CustomResourceOptions options)resources: _: type: ionoscloud:objectstorage:BucketPolicy get: 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
Resource Policy can be imported using the bucket name
$ pulumi import ionoscloud:objectstorage/bucketPolicy:BucketPolicy example example
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ionoscloud ionos-cloud/pulumi-ionoscloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
ionoscloudTerraform Provider.
published on Wednesday, Apr 15, 2026 by ionos-cloud
