1. Packages
  2. Packages
  3. Ionoscloud
  4. API Docs
  5. objectstorage
  6. ObjectLockConfiguration
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

    Manages Object Lock Configuration for Buckets 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",
        objectLockEnabled: true,
    });
    const test = new ionoscloud.objectstorage.ObjectLockConfiguration("test", {
        bucket: example.name,
        objectLockEnabled: "Enabled",
        rule: [{
            defaultRetention: [{
                mode: "GOVERNANCE",
                days: 1,
            }],
        }],
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.objectstorage.Bucket("example",
        name="example",
        object_lock_enabled=True)
    test = ionoscloud.objectstorage.ObjectLockConfiguration("test",
        bucket=example.name,
        object_lock_enabled="Enabled",
        rule=[{
            "defaultRetention": [{
                "mode": "GOVERNANCE",
                "days": 1,
            }],
        }])
    
    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 {
    		example, err := objectstorage.NewBucket(ctx, "example", &objectstorage.BucketArgs{
    			Name:              pulumi.String("example"),
    			ObjectLockEnabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = objectstorage.NewObjectLockConfiguration(ctx, "test", &objectstorage.ObjectLockConfigurationArgs{
    			Bucket:            example.Name,
    			ObjectLockEnabled: pulumi.String("Enabled"),
    			Rule: objectstorage.ObjectLockConfigurationRuleArgs{
    				map[string]interface{}{
    					"defaultRetention": []map[string]interface{}{
    						map[string]interface{}{
    							"mode": "GOVERNANCE",
    							"days": 1,
    						},
    					},
    				},
    			},
    		})
    		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 = new Ionoscloud.Objectstorage.Bucket("example", new()
        {
            Name = "example",
            ObjectLockEnabled = true,
        });
    
        var test = new Ionoscloud.Objectstorage.ObjectLockConfiguration("test", new()
        {
            Bucket = example.Name,
            ObjectLockEnabled = "Enabled",
            Rule = new[]
            {
                
                {
                    { "defaultRetention", new[]
                    {
                        
                        {
                            { "mode", "GOVERNANCE" },
                            { "days", 1 },
                        },
                    } },
                },
            },
        });
    
    });
    
    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.ObjectLockConfiguration;
    import com.ionoscloud.pulumi.ionoscloud.objectstorage.ObjectLockConfigurationArgs;
    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")
                .objectLockEnabled(true)
                .build());
    
            var test = new ObjectLockConfiguration("test", ObjectLockConfigurationArgs.builder()
                .bucket(example.name())
                .objectLockEnabled("Enabled")
                .rule(ObjectLockConfigurationRuleArgs.builder()
                    .defaultRetention(ObjectLockConfigurationRuleDefaultRetentionArgs.builder()
                        .mode("GOVERNANCE")
                        .days(1)
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: ionoscloud:objectstorage:Bucket
        properties:
          name: example
          objectLockEnabled: true
      test:
        type: ionoscloud:objectstorage:ObjectLockConfiguration
        properties:
          bucket: ${example.name}
          objectLockEnabled: Enabled
          rule:
            - defaultRetention:
                - mode: GOVERNANCE
                  days: 1
    
    Example coming soon!
    

    Create ObjectLockConfiguration Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ObjectLockConfiguration(name: string, args: ObjectLockConfigurationArgs, opts?: CustomResourceOptions);
    @overload
    def ObjectLockConfiguration(resource_name: str,
                                args: ObjectLockConfigurationArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def ObjectLockConfiguration(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                bucket: Optional[str] = None,
                                object_lock_enabled: Optional[str] = None,
                                rule: Optional[ObjectLockConfigurationRuleArgs] = None)
    func NewObjectLockConfiguration(ctx *Context, name string, args ObjectLockConfigurationArgs, opts ...ResourceOption) (*ObjectLockConfiguration, error)
    public ObjectLockConfiguration(string name, ObjectLockConfigurationArgs args, CustomResourceOptions? opts = null)
    public ObjectLockConfiguration(String name, ObjectLockConfigurationArgs args)
    public ObjectLockConfiguration(String name, ObjectLockConfigurationArgs args, CustomResourceOptions options)
    
    type: ionoscloud:objectstorage:ObjectLockConfiguration
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "ionoscloud_objectstorage_objectlockconfiguration" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ObjectLockConfigurationArgs
    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 ObjectLockConfigurationArgs
    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 ObjectLockConfigurationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ObjectLockConfigurationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ObjectLockConfigurationArgs
    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 objectLockConfigurationResource = new Ionoscloud.Objectstorage.ObjectLockConfiguration("objectLockConfigurationResource", new()
    {
        Bucket = "string",
        ObjectLockEnabled = "string",
        Rule = new Ionoscloud.Objectstorage.Inputs.ObjectLockConfigurationRuleArgs
        {
            DefaultRetention = new Ionoscloud.Objectstorage.Inputs.ObjectLockConfigurationRuleDefaultRetentionArgs
            {
                Days = 0,
                Mode = "string",
                Years = 0,
            },
        },
    });
    
    example, err := objectstorage.NewObjectLockConfiguration(ctx, "objectLockConfigurationResource", &objectstorage.ObjectLockConfigurationArgs{
    	Bucket:            pulumi.String("string"),
    	ObjectLockEnabled: pulumi.String("string"),
    	Rule: &objectstorage.ObjectLockConfigurationRuleArgs{
    		DefaultRetention: &objectstorage.ObjectLockConfigurationRuleDefaultRetentionArgs{
    			Days:  pulumi.Int(0),
    			Mode:  pulumi.String("string"),
    			Years: pulumi.Int(0),
    		},
    	},
    })
    
    resource "ionoscloud_objectstorage_objectlockconfiguration" "objectLockConfigurationResource" {
      bucket              = "string"
      object_lock_enabled = "string"
      rule = {
        default_retention = {
          days  = 0
          mode  = "string"
          years = 0
        }
      }
    }
    
    var objectLockConfigurationResource = new ObjectLockConfiguration("objectLockConfigurationResource", ObjectLockConfigurationArgs.builder()
        .bucket("string")
        .objectLockEnabled("string")
        .rule(ObjectLockConfigurationRuleArgs.builder()
            .defaultRetention(ObjectLockConfigurationRuleDefaultRetentionArgs.builder()
                .days(0)
                .mode("string")
                .years(0)
                .build())
            .build())
        .build());
    
    object_lock_configuration_resource = ionoscloud.objectstorage.ObjectLockConfiguration("objectLockConfigurationResource",
        bucket="string",
        object_lock_enabled="string",
        rule={
            "default_retention": {
                "days": 0,
                "mode": "string",
                "years": 0,
            },
        })
    
    const objectLockConfigurationResource = new ionoscloud.objectstorage.ObjectLockConfiguration("objectLockConfigurationResource", {
        bucket: "string",
        objectLockEnabled: "string",
        rule: {
            defaultRetention: {
                days: 0,
                mode: "string",
                years: 0,
            },
        },
    });
    
    type: ionoscloud:objectstorage:ObjectLockConfiguration
    properties:
        bucket: string
        objectLockEnabled: string
        rule:
            defaultRetention:
                days: 0
                mode: string
                years: 0
    

    ObjectLockConfiguration 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 ObjectLockConfiguration resource accepts the following input properties:

    Bucket string
    [string] The name of the bucket where the object will be stored.
    ObjectLockEnabled string
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    Rule Ionoscloud.ObjectLockConfigurationRule
    [block] A block of rule as defined below.
    Bucket string
    [string] The name of the bucket where the object will be stored.
    ObjectLockEnabled string
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    Rule ObjectLockConfigurationRuleArgs
    [block] A block of rule as defined below.
    bucket string
    [string] The name of the bucket where the object will be stored.
    object_lock_enabled string
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule object
    [block] A block of rule as defined below.
    bucket String
    [string] The name of the bucket where the object will be stored.
    objectLockEnabled String
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule ObjectLockConfigurationRule
    [block] A block of rule as defined below.
    bucket string
    [string] The name of the bucket where the object will be stored.
    objectLockEnabled string
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule ObjectLockConfigurationRule
    [block] A block of rule as defined below.
    bucket str
    [string] The name of the bucket where the object will be stored.
    object_lock_enabled str
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule ObjectLockConfigurationRuleArgs
    [block] A block of rule as defined below.
    bucket String
    [string] The name of the bucket where the object will be stored.
    objectLockEnabled String
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule Property Map
    [block] A block of rule as defined below.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ObjectLockConfiguration 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 ObjectLockConfiguration Resource

    Get an existing ObjectLockConfiguration 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?: ObjectLockConfigurationState, opts?: CustomResourceOptions): ObjectLockConfiguration
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket: Optional[str] = None,
            object_lock_enabled: Optional[str] = None,
            rule: Optional[ObjectLockConfigurationRuleArgs] = None) -> ObjectLockConfiguration
    func GetObjectLockConfiguration(ctx *Context, name string, id IDInput, state *ObjectLockConfigurationState, opts ...ResourceOption) (*ObjectLockConfiguration, error)
    public static ObjectLockConfiguration Get(string name, Input<string> id, ObjectLockConfigurationState? state, CustomResourceOptions? opts = null)
    public static ObjectLockConfiguration get(String name, Output<String> id, ObjectLockConfigurationState state, CustomResourceOptions options)
    resources:  _:    type: ionoscloud:objectstorage:ObjectLockConfiguration    get:      id: ${id}
    import {
      to = ionoscloud_objectstorage_objectlockconfiguration.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.
    The following state arguments are supported:
    Bucket string
    [string] The name of the bucket where the object will be stored.
    ObjectLockEnabled string
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    Rule Ionoscloud.ObjectLockConfigurationRule
    [block] A block of rule as defined below.
    Bucket string
    [string] The name of the bucket where the object will be stored.
    ObjectLockEnabled string
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    Rule ObjectLockConfigurationRuleArgs
    [block] A block of rule as defined below.
    bucket string
    [string] The name of the bucket where the object will be stored.
    object_lock_enabled string
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule object
    [block] A block of rule as defined below.
    bucket String
    [string] The name of the bucket where the object will be stored.
    objectLockEnabled String
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule ObjectLockConfigurationRule
    [block] A block of rule as defined below.
    bucket string
    [string] The name of the bucket where the object will be stored.
    objectLockEnabled string
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule ObjectLockConfigurationRule
    [block] A block of rule as defined below.
    bucket str
    [string] The name of the bucket where the object will be stored.
    object_lock_enabled str
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule ObjectLockConfigurationRuleArgs
    [block] A block of rule as defined below.
    bucket String
    [string] The name of the bucket where the object will be stored.
    objectLockEnabled String
    [Optional] The object lock configuration status of the bucket. Must be Enabled.
    rule Property Map
    [block] A block of rule as defined below.

    Supporting Types

    ObjectLockConfigurationRule, ObjectLockConfigurationRuleArgs

    DefaultRetention Ionoscloud.ObjectLockConfigurationRuleDefaultRetention
    [block] A block of defaultRetention as defined below.
    DefaultRetention ObjectLockConfigurationRuleDefaultRetention
    [block] A block of defaultRetention as defined below.
    default_retention object
    [block] A block of defaultRetention as defined below.
    defaultRetention ObjectLockConfigurationRuleDefaultRetention
    [block] A block of defaultRetention as defined below.
    defaultRetention ObjectLockConfigurationRuleDefaultRetention
    [block] A block of defaultRetention as defined below.
    default_retention ObjectLockConfigurationRuleDefaultRetention
    [block] A block of defaultRetention as defined below.
    defaultRetention Property Map
    [block] A block of defaultRetention as defined below.

    ObjectLockConfigurationRuleDefaultRetention, ObjectLockConfigurationRuleDefaultRetentionArgs

    Days int
    [int] The default retention period of the bucket in days.
    Mode string
    [string] The default retention mode of the bucket. Can be GOVERNANCE or COMPLIANCE.
    Years int

    [int] The default retention period of the bucket in years.

    Days and years are mutually exclusive. You can only specify one of them.

    Days int
    [int] The default retention period of the bucket in days.
    Mode string
    [string] The default retention mode of the bucket. Can be GOVERNANCE or COMPLIANCE.
    Years int

    [int] The default retention period of the bucket in years.

    Days and years are mutually exclusive. You can only specify one of them.

    days number
    [int] The default retention period of the bucket in days.
    mode string
    [string] The default retention mode of the bucket. Can be GOVERNANCE or COMPLIANCE.
    years number

    [int] The default retention period of the bucket in years.

    Days and years are mutually exclusive. You can only specify one of them.

    days Integer
    [int] The default retention period of the bucket in days.
    mode String
    [string] The default retention mode of the bucket. Can be GOVERNANCE or COMPLIANCE.
    years Integer

    [int] The default retention period of the bucket in years.

    Days and years are mutually exclusive. You can only specify one of them.

    days number
    [int] The default retention period of the bucket in days.
    mode string
    [string] The default retention mode of the bucket. Can be GOVERNANCE or COMPLIANCE.
    years number

    [int] The default retention period of the bucket in years.

    Days and years are mutually exclusive. You can only specify one of them.

    days int
    [int] The default retention period of the bucket in days.
    mode str
    [string] The default retention mode of the bucket. Can be GOVERNANCE or COMPLIANCE.
    years int

    [int] The default retention period of the bucket in years.

    Days and years are mutually exclusive. You can only specify one of them.

    days Number
    [int] The default retention period of the bucket in days.
    mode String
    [string] The default retention mode of the bucket. Can be GOVERNANCE or COMPLIANCE.
    years Number

    [int] The default retention period of the bucket in years.

    Days and years are mutually exclusive. You can only specify one of them.

    Import

    IONOS Object Storage Bucket object lock configuration can be imported using the bucket name.

    $ pulumi import ionoscloud:objectstorage/objectLockConfiguration:ObjectLockConfiguration 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 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.