1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. oss
  5. BucketWorm
Alibaba Cloud v3.96.0 published on Tuesday, Mar 3, 2026 by Pulumi
alicloud logo
Alibaba Cloud v3.96.0 published on Tuesday, Mar 3, 2026 by Pulumi

    Provides a OSS Bucket Worm resource.

    Bucket Retention Policy.

    For information about OSS Bucket Worm and how to use it, see What is Bucket Worm.

    NOTE: Available since v1.240.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 defaulthNMfIF = new alicloud.oss.Bucket("defaulthNMfIF", {storageClass: "Standard"});
    const _default = new alicloud.oss.BucketWorm("default", {
        bucket: defaulthNMfIF.bucket,
        retentionPeriodInDays: 1,
        status: "InProgress",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    defaulth_n_mf_if = alicloud.oss.Bucket("defaulthNMfIF", storage_class="Standard")
    default = alicloud.oss.BucketWorm("default",
        bucket=defaulth_n_mf_if.bucket,
        retention_period_in_days=1,
        status="InProgress")
    
    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
    		}
    		defaulthNMfIF, err := oss.NewBucket(ctx, "defaulthNMfIF", &oss.BucketArgs{
    			StorageClass: pulumi.String("Standard"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = oss.NewBucketWorm(ctx, "default", &oss.BucketWormArgs{
    			Bucket:                defaulthNMfIF.Bucket,
    			RetentionPeriodInDays: pulumi.Int(1),
    			Status:                pulumi.String("InProgress"),
    		})
    		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 defaulthNMfIF = new AliCloud.Oss.Bucket("defaulthNMfIF", new()
        {
            StorageClass = "Standard",
        });
    
        var @default = new AliCloud.Oss.BucketWorm("default", new()
        {
            Bucket = defaulthNMfIF.BucketName,
            RetentionPeriodInDays = 1,
            Status = "InProgress",
        });
    
    });
    
    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.BucketWorm;
    import com.pulumi.alicloud.oss.BucketWormArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var defaulthNMfIF = new Bucket("defaulthNMfIF", BucketArgs.builder()
                .storageClass("Standard")
                .build());
    
            var default_ = new BucketWorm("default", BucketWormArgs.builder()
                .bucket(defaulthNMfIF.bucket())
                .retentionPeriodInDays(1)
                .status("InProgress")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaulthNMfIF:
        type: alicloud:oss:Bucket
        properties:
          storageClass: Standard
      default:
        type: alicloud:oss:BucketWorm
        properties:
          bucket: ${defaulthNMfIF.bucket}
          retentionPeriodInDays: '1'
          status: InProgress
    

    Deleting alicloud.oss.BucketWorm or removing it from your configuration

    The alicloud.oss.BucketWorm resource allows you to manage status = "Locked" instance, but Terraform cannot destroy it. Deleting the subscription resource or removing it from your configuration will remove it from your state file and management, but will not destroy the Instance. You can resume managing the subscription instance via the AlibabaCloud Console.

    📚 Need more examples? VIEW MORE EXAMPLES

    Create BucketWorm Resource

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

    Constructor syntax

    new BucketWorm(name: string, args: BucketWormArgs, opts?: CustomResourceOptions);
    @overload
    def BucketWorm(resource_name: str,
                   args: BucketWormArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def BucketWorm(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   bucket: Optional[str] = None,
                   retention_period_in_days: Optional[int] = None,
                   status: Optional[str] = None)
    func NewBucketWorm(ctx *Context, name string, args BucketWormArgs, opts ...ResourceOption) (*BucketWorm, error)
    public BucketWorm(string name, BucketWormArgs args, CustomResourceOptions? opts = null)
    public BucketWorm(String name, BucketWormArgs args)
    public BucketWorm(String name, BucketWormArgs args, CustomResourceOptions options)
    
    type: alicloud:oss:BucketWorm
    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 BucketWormArgs
    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 BucketWormArgs
    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 BucketWormArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BucketWormArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BucketWormArgs
    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 bucketWormResource = new AliCloud.Oss.BucketWorm("bucketWormResource", new()
    {
        Bucket = "string",
        RetentionPeriodInDays = 0,
        Status = "string",
    });
    
    example, err := oss.NewBucketWorm(ctx, "bucketWormResource", &oss.BucketWormArgs{
    	Bucket:                pulumi.String("string"),
    	RetentionPeriodInDays: pulumi.Int(0),
    	Status:                pulumi.String("string"),
    })
    
    var bucketWormResource = new BucketWorm("bucketWormResource", BucketWormArgs.builder()
        .bucket("string")
        .retentionPeriodInDays(0)
        .status("string")
        .build());
    
    bucket_worm_resource = alicloud.oss.BucketWorm("bucketWormResource",
        bucket="string",
        retention_period_in_days=0,
        status="string")
    
    const bucketWormResource = new alicloud.oss.BucketWorm("bucketWormResource", {
        bucket: "string",
        retentionPeriodInDays: 0,
        status: "string",
    });
    
    type: alicloud:oss:BucketWorm
    properties:
        bucket: string
        retentionPeriodInDays: 0
        status: string
    

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

    Bucket string
    The name of the bucket
    RetentionPeriodInDays int
    The specified number of days to retain the Object.
    Status string
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    Bucket string
    The name of the bucket
    RetentionPeriodInDays int
    The specified number of days to retain the Object.
    Status string
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    bucket String
    The name of the bucket
    retentionPeriodInDays Integer
    The specified number of days to retain the Object.
    status String
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    bucket string
    The name of the bucket
    retentionPeriodInDays number
    The specified number of days to retain the Object.
    status string
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    bucket str
    The name of the bucket
    retention_period_in_days int
    The specified number of days to retain the Object.
    status str
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    bucket String
    The name of the bucket
    retentionPeriodInDays Number
    The specified number of days to retain the Object.
    status String
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BucketWorm resource produces the following output properties:

    CreateTime string
    The creation time of the resource
    Id string
    The provider-assigned unique ID for this managed resource.
    WormId string
    The ID of the retention policy.
    CreateTime string
    The creation time of the resource
    Id string
    The provider-assigned unique ID for this managed resource.
    WormId string
    The ID of the retention policy.
    createTime String
    The creation time of the resource
    id String
    The provider-assigned unique ID for this managed resource.
    wormId String
    The ID of the retention policy.
    createTime string
    The creation time of the resource
    id string
    The provider-assigned unique ID for this managed resource.
    wormId string
    The ID of the retention policy.
    create_time str
    The creation time of the resource
    id str
    The provider-assigned unique ID for this managed resource.
    worm_id str
    The ID of the retention policy.
    createTime String
    The creation time of the resource
    id String
    The provider-assigned unique ID for this managed resource.
    wormId String
    The ID of the retention policy.

    Look up Existing BucketWorm Resource

    Get an existing BucketWorm 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?: BucketWormState, opts?: CustomResourceOptions): BucketWorm
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket: Optional[str] = None,
            create_time: Optional[str] = None,
            retention_period_in_days: Optional[int] = None,
            status: Optional[str] = None,
            worm_id: Optional[str] = None) -> BucketWorm
    func GetBucketWorm(ctx *Context, name string, id IDInput, state *BucketWormState, opts ...ResourceOption) (*BucketWorm, error)
    public static BucketWorm Get(string name, Input<string> id, BucketWormState? state, CustomResourceOptions? opts = null)
    public static BucketWorm get(String name, Output<String> id, BucketWormState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:oss:BucketWorm    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.
    The following state arguments are supported:
    Bucket string
    The name of the bucket
    CreateTime string
    The creation time of the resource
    RetentionPeriodInDays int
    The specified number of days to retain the Object.
    Status string
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    WormId string
    The ID of the retention policy.
    Bucket string
    The name of the bucket
    CreateTime string
    The creation time of the resource
    RetentionPeriodInDays int
    The specified number of days to retain the Object.
    Status string
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    WormId string
    The ID of the retention policy.
    bucket String
    The name of the bucket
    createTime String
    The creation time of the resource
    retentionPeriodInDays Integer
    The specified number of days to retain the Object.
    status String
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    wormId String
    The ID of the retention policy.
    bucket string
    The name of the bucket
    createTime string
    The creation time of the resource
    retentionPeriodInDays number
    The specified number of days to retain the Object.
    status string
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    wormId string
    The ID of the retention policy.
    bucket str
    The name of the bucket
    create_time str
    The creation time of the resource
    retention_period_in_days int
    The specified number of days to retain the Object.
    status str
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    worm_id str
    The ID of the retention policy.
    bucket String
    The name of the bucket
    createTime String
    The creation time of the resource
    retentionPeriodInDays Number
    The specified number of days to retain the Object.
    status String
    The status of the compliance retention policy. Optional values:

    • InProgress: After a compliance retention policy is created, the policy is in the InProgress status by default, and the validity period of this status is 24 hours.
    • Locked: The compliance retention policy is Locked.
    wormId String
    The ID of the retention policy.

    Import

    OSS Bucket Worm can be imported using the id, e.g.

    $ pulumi import alicloud:oss/bucketWorm:BucketWorm example <bucket>:<worm_id>
    

    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 alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.96.0 published on Tuesday, Mar 3, 2026 by Pulumi
      Meet Neo: Your AI Platform Teammate