scaleway.ObjectBucketLockConfiguration
Explore with Pulumi AI
The scaleway.ObjectBucketLockConfiguration
resource allows you to create and manage an object lock configuration for Scaleway Object storage.
Refer to the dedicated documentation for more information on object lock.
Example Usage
Configure an Object Lock for a new bucket
Note:
object_lock_enabled
must be set totrue
before configuring the lock.
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
const main = new scaleway.ObjectBucket("main", {
name: "MyBucket",
acl: "public-read",
objectLockEnabled: true,
});
const mainObjectBucketLockConfiguration = new scaleway.ObjectBucketLockConfiguration("main", {
bucket: main.name,
rule: {
defaultRetention: {
mode: "GOVERNANCE",
days: 1,
},
},
});
import pulumi
import pulumiverse_scaleway as scaleway
main = scaleway.ObjectBucket("main",
name="MyBucket",
acl="public-read",
object_lock_enabled=True)
main_object_bucket_lock_configuration = scaleway.ObjectBucketLockConfiguration("main",
bucket=main.name,
rule={
"default_retention": {
"mode": "GOVERNANCE",
"days": 1,
},
})
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := scaleway.NewObjectBucket(ctx, "main", &scaleway.ObjectBucketArgs{
Name: pulumi.String("MyBucket"),
Acl: pulumi.String("public-read"),
ObjectLockEnabled: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = scaleway.NewObjectBucketLockConfiguration(ctx, "main", &scaleway.ObjectBucketLockConfigurationArgs{
Bucket: main.Name,
Rule: &scaleway.ObjectBucketLockConfigurationRuleArgs{
DefaultRetention: &scaleway.ObjectBucketLockConfigurationRuleDefaultRetentionArgs{
Mode: pulumi.String("GOVERNANCE"),
Days: pulumi.Int(1),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumiverse.Scaleway;
return await Deployment.RunAsync(() =>
{
var main = new Scaleway.ObjectBucket("main", new()
{
Name = "MyBucket",
Acl = "public-read",
ObjectLockEnabled = true,
});
var mainObjectBucketLockConfiguration = new Scaleway.ObjectBucketLockConfiguration("main", new()
{
Bucket = main.Name,
Rule = new Scaleway.Inputs.ObjectBucketLockConfigurationRuleArgs
{
DefaultRetention = new Scaleway.Inputs.ObjectBucketLockConfigurationRuleDefaultRetentionArgs
{
Mode = "GOVERNANCE",
Days = 1,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.ObjectBucket;
import com.pulumi.scaleway.ObjectBucketArgs;
import com.pulumi.scaleway.ObjectBucketLockConfiguration;
import com.pulumi.scaleway.ObjectBucketLockConfigurationArgs;
import com.pulumi.scaleway.inputs.ObjectBucketLockConfigurationRuleArgs;
import com.pulumi.scaleway.inputs.ObjectBucketLockConfigurationRuleDefaultRetentionArgs;
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 main = new ObjectBucket("main", ObjectBucketArgs.builder()
.name("MyBucket")
.acl("public-read")
.objectLockEnabled(true)
.build());
var mainObjectBucketLockConfiguration = new ObjectBucketLockConfiguration("mainObjectBucketLockConfiguration", ObjectBucketLockConfigurationArgs.builder()
.bucket(main.name())
.rule(ObjectBucketLockConfigurationRuleArgs.builder()
.defaultRetention(ObjectBucketLockConfigurationRuleDefaultRetentionArgs.builder()
.mode("GOVERNANCE")
.days(1)
.build())
.build())
.build());
}
}
resources:
main:
type: scaleway:ObjectBucket
properties:
name: MyBucket
acl: public-read
objectLockEnabled: true
mainObjectBucketLockConfiguration:
type: scaleway:ObjectBucketLockConfiguration
name: main
properties:
bucket: ${main.name}
rule:
defaultRetention:
mode: GOVERNANCE
days: 1
Configure an object Lock for an existing bucket
Contact Scaleway support to enable object lock on an existing bucket.
Create ObjectBucketLockConfiguration Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ObjectBucketLockConfiguration(name: string, args: ObjectBucketLockConfigurationArgs, opts?: CustomResourceOptions);
@overload
def ObjectBucketLockConfiguration(resource_name: str,
args: ObjectBucketLockConfigurationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ObjectBucketLockConfiguration(resource_name: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
rule: Optional[ObjectBucketLockConfigurationRuleArgs] = None,
project_id: Optional[str] = None,
region: Optional[str] = None)
func NewObjectBucketLockConfiguration(ctx *Context, name string, args ObjectBucketLockConfigurationArgs, opts ...ResourceOption) (*ObjectBucketLockConfiguration, error)
public ObjectBucketLockConfiguration(string name, ObjectBucketLockConfigurationArgs args, CustomResourceOptions? opts = null)
public ObjectBucketLockConfiguration(String name, ObjectBucketLockConfigurationArgs args)
public ObjectBucketLockConfiguration(String name, ObjectBucketLockConfigurationArgs args, CustomResourceOptions options)
type: scaleway:ObjectBucketLockConfiguration
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 ObjectBucketLockConfigurationArgs
- 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 ObjectBucketLockConfigurationArgs
- 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 ObjectBucketLockConfigurationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ObjectBucketLockConfigurationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ObjectBucketLockConfigurationArgs
- 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 objectBucketLockConfigurationResource = new Scaleway.ObjectBucketLockConfiguration("objectBucketLockConfigurationResource", new()
{
Bucket = "string",
Rule = new Scaleway.Inputs.ObjectBucketLockConfigurationRuleArgs
{
DefaultRetention = new Scaleway.Inputs.ObjectBucketLockConfigurationRuleDefaultRetentionArgs
{
Mode = "string",
Days = 0,
Years = 0,
},
},
ProjectId = "string",
Region = "string",
});
example, err := scaleway.NewObjectBucketLockConfiguration(ctx, "objectBucketLockConfigurationResource", &scaleway.ObjectBucketLockConfigurationArgs{
Bucket: pulumi.String("string"),
Rule: &scaleway.ObjectBucketLockConfigurationRuleArgs{
DefaultRetention: &scaleway.ObjectBucketLockConfigurationRuleDefaultRetentionArgs{
Mode: pulumi.String("string"),
Days: pulumi.Int(0),
Years: pulumi.Int(0),
},
},
ProjectId: pulumi.String("string"),
Region: pulumi.String("string"),
})
var objectBucketLockConfigurationResource = new ObjectBucketLockConfiguration("objectBucketLockConfigurationResource", ObjectBucketLockConfigurationArgs.builder()
.bucket("string")
.rule(ObjectBucketLockConfigurationRuleArgs.builder()
.defaultRetention(ObjectBucketLockConfigurationRuleDefaultRetentionArgs.builder()
.mode("string")
.days(0)
.years(0)
.build())
.build())
.projectId("string")
.region("string")
.build());
object_bucket_lock_configuration_resource = scaleway.ObjectBucketLockConfiguration("objectBucketLockConfigurationResource",
bucket="string",
rule={
"default_retention": {
"mode": "string",
"days": 0,
"years": 0,
},
},
project_id="string",
region="string")
const objectBucketLockConfigurationResource = new scaleway.ObjectBucketLockConfiguration("objectBucketLockConfigurationResource", {
bucket: "string",
rule: {
defaultRetention: {
mode: "string",
days: 0,
years: 0,
},
},
projectId: "string",
region: "string",
});
type: scaleway:ObjectBucketLockConfiguration
properties:
bucket: string
projectId: string
region: string
rule:
defaultRetention:
days: 0
mode: string
years: 0
ObjectBucketLockConfiguration 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 ObjectBucketLockConfiguration resource accepts the following input properties:
- Bucket string
- The bucket's name or regional ID.
- Rule
Pulumiverse.
Scaleway. Inputs. Object Bucket Lock Configuration Rule - Specifies the object lock rule for the specified object.
- Project
Id string - The project_id you want to attach the resource to
- Region string
- The region you want to attach the resource to
- Bucket string
- The bucket's name or regional ID.
- Rule
Object
Bucket Lock Configuration Rule Args - Specifies the object lock rule for the specified object.
- Project
Id string - The project_id you want to attach the resource to
- Region string
- The region you want to attach the resource to
- bucket String
- The bucket's name or regional ID.
- rule
Object
Bucket Lock Configuration Rule - Specifies the object lock rule for the specified object.
- project
Id String - The project_id you want to attach the resource to
- region String
- The region you want to attach the resource to
- bucket string
- The bucket's name or regional ID.
- rule
Object
Bucket Lock Configuration Rule - Specifies the object lock rule for the specified object.
- project
Id string - The project_id you want to attach the resource to
- region string
- The region you want to attach the resource to
- bucket str
- The bucket's name or regional ID.
- rule
Object
Bucket Lock Configuration Rule Args - Specifies the object lock rule for the specified object.
- project_
id str - The project_id you want to attach the resource to
- region str
- The region you want to attach the resource to
- bucket String
- The bucket's name or regional ID.
- rule Property Map
- Specifies the object lock rule for the specified object.
- project
Id String - The project_id you want to attach the resource to
- region String
- The region you want to attach the resource to
Outputs
All input properties are implicitly available as output properties. Additionally, the ObjectBucketLockConfiguration 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 ObjectBucketLockConfiguration Resource
Get an existing ObjectBucketLockConfiguration 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?: ObjectBucketLockConfigurationState, opts?: CustomResourceOptions): ObjectBucketLockConfiguration
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
project_id: Optional[str] = None,
region: Optional[str] = None,
rule: Optional[ObjectBucketLockConfigurationRuleArgs] = None) -> ObjectBucketLockConfiguration
func GetObjectBucketLockConfiguration(ctx *Context, name string, id IDInput, state *ObjectBucketLockConfigurationState, opts ...ResourceOption) (*ObjectBucketLockConfiguration, error)
public static ObjectBucketLockConfiguration Get(string name, Input<string> id, ObjectBucketLockConfigurationState? state, CustomResourceOptions? opts = null)
public static ObjectBucketLockConfiguration get(String name, Output<String> id, ObjectBucketLockConfigurationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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 string
- The bucket's name or regional ID.
- Project
Id string - The project_id you want to attach the resource to
- Region string
- The region you want to attach the resource to
- Rule
Pulumiverse.
Scaleway. Inputs. Object Bucket Lock Configuration Rule - Specifies the object lock rule for the specified object.
- Bucket string
- The bucket's name or regional ID.
- Project
Id string - The project_id you want to attach the resource to
- Region string
- The region you want to attach the resource to
- Rule
Object
Bucket Lock Configuration Rule Args - Specifies the object lock rule for the specified object.
- bucket String
- The bucket's name or regional ID.
- project
Id String - The project_id you want to attach the resource to
- region String
- The region you want to attach the resource to
- rule
Object
Bucket Lock Configuration Rule - Specifies the object lock rule for the specified object.
- bucket string
- The bucket's name or regional ID.
- project
Id string - The project_id you want to attach the resource to
- region string
- The region you want to attach the resource to
- rule
Object
Bucket Lock Configuration Rule - Specifies the object lock rule for the specified object.
- bucket str
- The bucket's name or regional ID.
- project_
id str - The project_id you want to attach the resource to
- region str
- The region you want to attach the resource to
- rule
Object
Bucket Lock Configuration Rule Args - Specifies the object lock rule for the specified object.
- bucket String
- The bucket's name or regional ID.
- project
Id String - The project_id you want to attach the resource to
- region String
- The region you want to attach the resource to
- rule Property Map
- Specifies the object lock rule for the specified object.
Supporting Types
ObjectBucketLockConfigurationRule, ObjectBucketLockConfigurationRuleArgs
- Default
Retention Pulumiverse.Scaleway. Inputs. Object Bucket Lock Configuration Rule Default Retention - The default retention for the lock.
- Default
Retention ObjectBucket Lock Configuration Rule Default Retention - The default retention for the lock.
- default
Retention ObjectBucket Lock Configuration Rule Default Retention - The default retention for the lock.
- default
Retention ObjectBucket Lock Configuration Rule Default Retention - The default retention for the lock.
- default_
retention ObjectBucket Lock Configuration Rule Default Retention - The default retention for the lock.
- default
Retention Property Map - The default retention for the lock.
ObjectBucketLockConfigurationRuleDefaultRetention, ObjectBucketLockConfigurationRuleDefaultRetentionArgs
- Mode string
- The default object lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are
GOVERNANCE
orCOMPLIANCE
. Refer to the dedicated documentation for more information on retention modes. - Days int
- The number of days you want to specify for the default retention period.
- Years int
- The number of years you want to specify for the default retention period.
- Mode string
- The default object lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are
GOVERNANCE
orCOMPLIANCE
. Refer to the dedicated documentation for more information on retention modes. - Days int
- The number of days you want to specify for the default retention period.
- Years int
- The number of years you want to specify for the default retention period.
- mode String
- The default object lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are
GOVERNANCE
orCOMPLIANCE
. Refer to the dedicated documentation for more information on retention modes. - days Integer
- The number of days you want to specify for the default retention period.
- years Integer
- The number of years you want to specify for the default retention period.
- mode string
- The default object lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are
GOVERNANCE
orCOMPLIANCE
. Refer to the dedicated documentation for more information on retention modes. - days number
- The number of days you want to specify for the default retention period.
- years number
- The number of years you want to specify for the default retention period.
- mode str
- The default object lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are
GOVERNANCE
orCOMPLIANCE
. Refer to the dedicated documentation for more information on retention modes. - days int
- The number of days you want to specify for the default retention period.
- years int
- The number of years you want to specify for the default retention period.
- mode String
- The default object lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are
GOVERNANCE
orCOMPLIANCE
. Refer to the dedicated documentation for more information on retention modes. - days Number
- The number of days you want to specify for the default retention period.
- years Number
- The number of years you want to specify for the default retention period.
Import
Bucket lock configurations can be imported using the {region}/{bucketName}
identifier, as shown below:
bash
$ pulumi import scaleway:index/objectBucketLockConfiguration:ObjectBucketLockConfiguration some_bucket fr-par/some-bucket
~> Important: The project_id
attribute has a particular behavior with s3 products because the s3 API is scoped by project.
If you are using a project different from the default one, you have to specify the project ID at the end of the import command.
bash
$ pulumi import scaleway:index/objectBucketLockConfiguration:ObjectBucketLockConfiguration some_bucket fr-par/some-bucket@xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- scaleway pulumiverse/pulumi-scaleway
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
scaleway
Terraform Provider.