diff --git a/README.md b/README.md index 8ce17e7..4147d83 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ module "my_bucket" { |------|-------------|------|---------|:--------:| | [name](#input_name) | Name of the bucket. | `string` | n/a | yes | | [force_destroy](#input_force_destroy) | Enable deletion of objects in bucket before destroying, locked objects or under legal hold are also deleted and not recoverable. | `bool` | `false` | no | +| [project_id](#input_project_id) | ID of the project the bucket is associated with. If null, ressources will be created in the default project associated with the key. | `string` | `null` | no | +| [region](#input_region) | Region in which the bucket should be created. Ressource will be created in the region set at the provider level if null. | `string` | `null` | no | | [versioning_enabled](#input_versioning_enabled) | Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state. You can, however, suspend versioning on that bucket. | `bool` | `false` | no | | [versioning_lock_configuration](#input_versioning_lock_configuration) | Specifies the Object Lock rule for the bucket. Requires versioning. | ```object({ mode = string, days = optional(number), years = optional(number), })``` | ```{ "days": null, "mode": "GOVERNANCE", "years": null }``` | no | diff --git a/main.tf b/main.tf index 8fda384..7d49587 100644 --- a/main.tf +++ b/main.tf @@ -3,6 +3,9 @@ resource "scaleway_object_bucket" "this" { name = var.name object_lock_enabled = var.versioning_enabled + region = var.region + project_id = var.project_id + versioning { enabled = var.versioning_enabled } @@ -11,7 +14,8 @@ resource "scaleway_object_bucket" "this" { resource "scaleway_object_bucket_lock_configuration" "this" { count = var.versioning_enabled ? 1 : 0 - bucket = scaleway_object_bucket.this.name + bucket = scaleway_object_bucket.this.name + project_id = var.project_id rule { default_retention { diff --git a/variables.tf b/variables.tf index cbefb6e..74b8f75 100644 --- a/variables.tf +++ b/variables.tf @@ -9,6 +9,18 @@ variable "name" { type = string } +variable "project_id" { + description = "ID of the project the bucket is associated with. If null, ressources will be created in the default project associated with the key." + type = string + default = null +} + +variable "region" { + description = "Region in which the bucket should be created. Ressource will be created in the region set at the provider level if null." + type = string + default = null +} + variable "versioning_enabled" { description = "Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state. You can, however, suspend versioning on that bucket." type = bool