published on Friday, May 22, 2026 by Pulumi
published on Friday, May 22, 2026 by Pulumi
Provides a OSS Bucket Object Worm Configuration resource.
Stores the Object-level compliant retention policy configuration for a bucket.
For information about OSS Bucket Object Worm Configuration and how to use it, see What is Bucket Object Worm Configuration.
NOTE: Available since v1.278.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const defaultQf8G0L = new alicloud.oss.Bucket("defaultQf8G0L", {storageClass: "Standard"});
const defaultosxikW = new alicloud.oss.BucketVersioning("defaultosxikW", {
status: "Enabled",
bucket: defaultQf8G0L.id,
});
const _default = new alicloud.oss.BucketObjectWormConfiguration("default", {
bucketName: defaultQf8G0L.id,
objectWormEnabled: "Enabled",
rule: {
defaultRetention: {
mode: "COMPLIANCE",
days: 1,
},
},
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default_qf8_g0_l = alicloud.oss.Bucket("defaultQf8G0L", storage_class="Standard")
defaultosxik_w = alicloud.oss.BucketVersioning("defaultosxikW",
status="Enabled",
bucket=default_qf8_g0_l.id)
default = alicloud.oss.BucketObjectWormConfiguration("default",
bucket_name=default_qf8_g0_l.id,
object_worm_enabled="Enabled",
rule={
"default_retention": {
"mode": "COMPLIANCE",
"days": 1,
},
})
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
defaultQf8G0L, err := oss.NewBucket(ctx, "defaultQf8G0L", &oss.BucketArgs{
StorageClass: pulumi.String("Standard"),
})
if err != nil {
return err
}
_, err = oss.NewBucketVersioning(ctx, "defaultosxikW", &oss.BucketVersioningArgs{
Status: pulumi.String("Enabled"),
Bucket: defaultQf8G0L.ID(),
})
if err != nil {
return err
}
_, err = oss.NewBucketObjectWormConfiguration(ctx, "default", &oss.BucketObjectWormConfigurationArgs{
BucketName: defaultQf8G0L.ID(),
ObjectWormEnabled: pulumi.String("Enabled"),
Rule: &oss.BucketObjectWormConfigurationRuleArgs{
DefaultRetention: &oss.BucketObjectWormConfigurationRuleDefaultRetentionArgs{
Mode: pulumi.String("COMPLIANCE"),
Days: pulumi.Int(1),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var defaultQf8G0L = new AliCloud.Oss.Bucket("defaultQf8G0L", new()
{
StorageClass = "Standard",
});
var defaultosxikW = new AliCloud.Oss.BucketVersioning("defaultosxikW", new()
{
Status = "Enabled",
Bucket = defaultQf8G0L.Id,
});
var @default = new AliCloud.Oss.BucketObjectWormConfiguration("default", new()
{
BucketName = defaultQf8G0L.Id,
ObjectWormEnabled = "Enabled",
Rule = new AliCloud.Oss.Inputs.BucketObjectWormConfigurationRuleArgs
{
DefaultRetention = new AliCloud.Oss.Inputs.BucketObjectWormConfigurationRuleDefaultRetentionArgs
{
Mode = "COMPLIANCE",
Days = 1,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.oss.Bucket;
import com.pulumi.alicloud.oss.BucketArgs;
import com.pulumi.alicloud.oss.BucketVersioning;
import com.pulumi.alicloud.oss.BucketVersioningArgs;
import com.pulumi.alicloud.oss.BucketObjectWormConfiguration;
import com.pulumi.alicloud.oss.BucketObjectWormConfigurationArgs;
import com.pulumi.alicloud.oss.inputs.BucketObjectWormConfigurationRuleArgs;
import com.pulumi.alicloud.oss.inputs.BucketObjectWormConfigurationRuleDefaultRetentionArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
var defaultQf8G0L = new Bucket("defaultQf8G0L", BucketArgs.builder()
.storageClass("Standard")
.build());
var defaultosxikW = new BucketVersioning("defaultosxikW", BucketVersioningArgs.builder()
.status("Enabled")
.bucket(defaultQf8G0L.id())
.build());
var default_ = new BucketObjectWormConfiguration("default", BucketObjectWormConfigurationArgs.builder()
.bucketName(defaultQf8G0L.id())
.objectWormEnabled("Enabled")
.rule(BucketObjectWormConfigurationRuleArgs.builder()
.defaultRetention(BucketObjectWormConfigurationRuleDefaultRetentionArgs.builder()
.mode("COMPLIANCE")
.days(1)
.build())
.build())
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
defaultQf8G0L:
type: alicloud:oss:Bucket
properties:
storageClass: Standard
defaultosxikW:
type: alicloud:oss:BucketVersioning
properties:
status: Enabled
bucket: ${defaultQf8G0L.id}
default:
type: alicloud:oss:BucketObjectWormConfiguration
properties:
bucketName: ${defaultQf8G0L.id}
objectWormEnabled: Enabled
rule:
defaultRetention:
mode: COMPLIANCE
days: '1'
pulumi {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
resource "alicloud_oss_bucket" "defaultQf8G0L" {
storage_class = "Standard"
}
resource "alicloud_oss_bucketversioning" "defaultosxikW" {
status = "Enabled"
bucket = alicloud_oss_bucket.defaultQf8G0L.id
}
resource "alicloud_oss_bucketobjectwormconfiguration" "default" {
bucket_name = alicloud_oss_bucket.defaultQf8G0L.id
object_worm_enabled = "Enabled"
rule = {
default_retention = {
mode = "COMPLIANCE"
days = "1"
}
}
}
variable "name" {
type = string
default = "terraform-example"
}
Deleting alicloud.oss.BucketObjectWormConfiguration or removing it from your configuration
Terraform cannot destroy resource alicloud.oss.BucketObjectWormConfiguration. Terraform will remove this resource from the state file, however resources may remain.
📚 Need more examples? VIEW MORE EXAMPLES
Create BucketObjectWormConfiguration Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new BucketObjectWormConfiguration(name: string, args: BucketObjectWormConfigurationArgs, opts?: CustomResourceOptions);@overload
def BucketObjectWormConfiguration(resource_name: str,
args: BucketObjectWormConfigurationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def BucketObjectWormConfiguration(resource_name: str,
opts: Optional[ResourceOptions] = None,
bucket_name: Optional[str] = None,
object_worm_enabled: Optional[str] = None,
rule: Optional[BucketObjectWormConfigurationRuleArgs] = None)func NewBucketObjectWormConfiguration(ctx *Context, name string, args BucketObjectWormConfigurationArgs, opts ...ResourceOption) (*BucketObjectWormConfiguration, error)public BucketObjectWormConfiguration(string name, BucketObjectWormConfigurationArgs args, CustomResourceOptions? opts = null)
public BucketObjectWormConfiguration(String name, BucketObjectWormConfigurationArgs args)
public BucketObjectWormConfiguration(String name, BucketObjectWormConfigurationArgs args, CustomResourceOptions options)
type: alicloud:oss:BucketObjectWormConfiguration
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "alicloud_oss_bucketobjectwormconfiguration" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args BucketObjectWormConfigurationArgs
- 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 BucketObjectWormConfigurationArgs
- 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 BucketObjectWormConfigurationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BucketObjectWormConfigurationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BucketObjectWormConfigurationArgs
- 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 bucketObjectWormConfigurationResource = new AliCloud.Oss.BucketObjectWormConfiguration("bucketObjectWormConfigurationResource", new()
{
BucketName = "string",
ObjectWormEnabled = "string",
Rule = new AliCloud.Oss.Inputs.BucketObjectWormConfigurationRuleArgs
{
DefaultRetention = new AliCloud.Oss.Inputs.BucketObjectWormConfigurationRuleDefaultRetentionArgs
{
Days = 0,
Mode = "string",
Years = 0,
},
},
});
example, err := oss.NewBucketObjectWormConfiguration(ctx, "bucketObjectWormConfigurationResource", &oss.BucketObjectWormConfigurationArgs{
BucketName: pulumi.String("string"),
ObjectWormEnabled: pulumi.String("string"),
Rule: &oss.BucketObjectWormConfigurationRuleArgs{
DefaultRetention: &oss.BucketObjectWormConfigurationRuleDefaultRetentionArgs{
Days: pulumi.Int(0),
Mode: pulumi.String("string"),
Years: pulumi.Int(0),
},
},
})
resource "alicloud_oss_bucketobjectwormconfiguration" "bucketObjectWormConfigurationResource" {
bucket_name = "string"
object_worm_enabled = "string"
rule = {
default_retention = {
days = 0
mode = "string"
years = 0
}
}
}
var bucketObjectWormConfigurationResource = new BucketObjectWormConfiguration("bucketObjectWormConfigurationResource", BucketObjectWormConfigurationArgs.builder()
.bucketName("string")
.objectWormEnabled("string")
.rule(BucketObjectWormConfigurationRuleArgs.builder()
.defaultRetention(BucketObjectWormConfigurationRuleDefaultRetentionArgs.builder()
.days(0)
.mode("string")
.years(0)
.build())
.build())
.build());
bucket_object_worm_configuration_resource = alicloud.oss.BucketObjectWormConfiguration("bucketObjectWormConfigurationResource",
bucket_name="string",
object_worm_enabled="string",
rule={
"default_retention": {
"days": 0,
"mode": "string",
"years": 0,
},
})
const bucketObjectWormConfigurationResource = new alicloud.oss.BucketObjectWormConfiguration("bucketObjectWormConfigurationResource", {
bucketName: "string",
objectWormEnabled: "string",
rule: {
defaultRetention: {
days: 0,
mode: "string",
years: 0,
},
},
});
type: alicloud:oss:BucketObjectWormConfiguration
properties:
bucketName: string
objectWormEnabled: string
rule:
defaultRetention:
days: 0
mode: string
years: 0
BucketObjectWormConfiguration 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 BucketObjectWormConfiguration resource accepts the following input properties:
- Bucket
Name string - Bucket name
- Object
Worm stringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- Rule
Pulumi.
Ali Cloud. Oss. Inputs. Bucket Object Worm Configuration Rule - Container that stores the list of retention policies. See
rulebelow.
- Bucket
Name string - Bucket name
- Object
Worm stringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- Rule
Bucket
Object Worm Configuration Rule Args - Container that stores the list of retention policies. See
rulebelow.
- bucket_
name string - Bucket name
- object_
worm_ stringenabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule object
- Container that stores the list of retention policies. See
rulebelow.
- bucket
Name String - Bucket name
- object
Worm StringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule
Bucket
Object Worm Configuration Rule - Container that stores the list of retention policies. See
rulebelow.
- bucket
Name string - Bucket name
- object
Worm stringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule
Bucket
Object Worm Configuration Rule - Container that stores the list of retention policies. See
rulebelow.
- bucket_
name str - Bucket name
- object_
worm_ strenabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule
Bucket
Object Worm Configuration Rule Args - Container that stores the list of retention policies. See
rulebelow.
- bucket
Name String - Bucket name
- object
Worm StringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule Property Map
- Container that stores the list of retention policies. See
rulebelow.
Outputs
All input properties are implicitly available as output properties. Additionally, the BucketObjectWormConfiguration 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 BucketObjectWormConfiguration Resource
Get an existing BucketObjectWormConfiguration 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?: BucketObjectWormConfigurationState, opts?: CustomResourceOptions): BucketObjectWormConfiguration@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bucket_name: Optional[str] = None,
object_worm_enabled: Optional[str] = None,
rule: Optional[BucketObjectWormConfigurationRuleArgs] = None) -> BucketObjectWormConfigurationfunc GetBucketObjectWormConfiguration(ctx *Context, name string, id IDInput, state *BucketObjectWormConfigurationState, opts ...ResourceOption) (*BucketObjectWormConfiguration, error)public static BucketObjectWormConfiguration Get(string name, Input<string> id, BucketObjectWormConfigurationState? state, CustomResourceOptions? opts = null)public static BucketObjectWormConfiguration get(String name, Output<String> id, BucketObjectWormConfigurationState state, CustomResourceOptions options)resources: _: type: alicloud:oss:BucketObjectWormConfiguration get: id: ${id}import {
to = alicloud_oss_bucketobjectwormconfiguration.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.
- Bucket
Name string - Bucket name
- Object
Worm stringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- Rule
Pulumi.
Ali Cloud. Oss. Inputs. Bucket Object Worm Configuration Rule - Container that stores the list of retention policies. See
rulebelow.
- Bucket
Name string - Bucket name
- Object
Worm stringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- Rule
Bucket
Object Worm Configuration Rule Args - Container that stores the list of retention policies. See
rulebelow.
- bucket_
name string - Bucket name
- object_
worm_ stringenabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule object
- Container that stores the list of retention policies. See
rulebelow.
- bucket
Name String - Bucket name
- object
Worm StringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule
Bucket
Object Worm Configuration Rule - Container that stores the list of retention policies. See
rulebelow.
- bucket
Name string - Bucket name
- object
Worm stringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule
Bucket
Object Worm Configuration Rule - Container that stores the list of retention policies. See
rulebelow.
- bucket_
name str - Bucket name
- object_
worm_ strenabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule
Bucket
Object Worm Configuration Rule Args - Container that stores the list of retention policies. See
rulebelow.
- bucket
Name String - Bucket name
- object
Worm StringEnabled - Specifies whether to enable the object-level compliance retention policy configuration.
- rule Property Map
- Container that stores the list of retention policies. See
rulebelow.
Supporting Types
BucketObjectWormConfigurationRule, BucketObjectWormConfigurationRuleArgs
- Default
Retention Pulumi.Ali Cloud. Oss. Inputs. Bucket Object Worm Configuration Rule Default Retention - Container for the default retention policy. See
defaultRetentionbelow.
- Default
Retention BucketObject Worm Configuration Rule Default Retention - Container for the default retention policy. See
defaultRetentionbelow.
- default_
retention object - Container for the default retention policy. See
defaultRetentionbelow.
- default
Retention BucketObject Worm Configuration Rule Default Retention - Container for the default retention policy. See
defaultRetentionbelow.
- default
Retention BucketObject Worm Configuration Rule Default Retention - Container for the default retention policy. See
defaultRetentionbelow.
- default_
retention BucketObject Worm Configuration Rule Default Retention - Container for the default retention policy. See
defaultRetentionbelow.
- default
Retention Property Map - Container for the default retention policy. See
defaultRetentionbelow.
BucketObjectWormConfigurationRuleDefaultRetention, BucketObjectWormConfigurationRuleDefaultRetentionArgs
- Days int
- The number of days for compliant retention. This parameter is mutually exclusive with the Years parameter; only one of them can be specified.
- Mode string
- Compliance retention mode.
- Years int
- Default retention period in years. Valid values: 1 to 100. You can specify either Days or Years, but not both.
- Days int
- The number of days for compliant retention. This parameter is mutually exclusive with the Years parameter; only one of them can be specified.
- Mode string
- Compliance retention mode.
- Years int
- Default retention period in years. Valid values: 1 to 100. You can specify either Days or Years, but not both.
- days number
- The number of days for compliant retention. This parameter is mutually exclusive with the Years parameter; only one of them can be specified.
- mode string
- Compliance retention mode.
- years number
- Default retention period in years. Valid values: 1 to 100. You can specify either Days or Years, but not both.
- days Integer
- The number of days for compliant retention. This parameter is mutually exclusive with the Years parameter; only one of them can be specified.
- mode String
- Compliance retention mode.
- years Integer
- Default retention period in years. Valid values: 1 to 100. You can specify either Days or Years, but not both.
- days number
- The number of days for compliant retention. This parameter is mutually exclusive with the Years parameter; only one of them can be specified.
- mode string
- Compliance retention mode.
- years number
- Default retention period in years. Valid values: 1 to 100. You can specify either Days or Years, but not both.
- days int
- The number of days for compliant retention. This parameter is mutually exclusive with the Years parameter; only one of them can be specified.
- mode str
- Compliance retention mode.
- years int
- Default retention period in years. Valid values: 1 to 100. You can specify either Days or Years, but not both.
- days Number
- The number of days for compliant retention. This parameter is mutually exclusive with the Years parameter; only one of them can be specified.
- mode String
- Compliance retention mode.
- years Number
- Default retention period in years. Valid values: 1 to 100. You can specify either Days or Years, but not both.
Import
OSS Bucket Object Worm Configuration can be imported using the id, e.g.
$ pulumi import alicloud:oss/bucketObjectWormConfiguration:BucketObjectWormConfiguration example <bucket_name>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.
published on Friday, May 22, 2026 by Pulumi