Skip to content

Commit 300d00b

Browse files
feat: Add options to set Project ID and Region. (#2)
1 parent 9ed0aa9 commit 300d00b

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ module "my_bucket" {
3838
|------|-------------|------|---------|:--------:|
3939
| <a name="input_name"></a> [name](#input_name) | Name of the bucket. | `string` | n/a | yes |
4040
| <a name="input_force_destroy"></a> [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 |
41+
| <a name="input_project_id"></a> [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 |
42+
| <a name="input_region"></a> [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 |
4143
| <a name="input_versioning_enabled"></a> [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 |
4244
| <a name="input_versioning_lock_configuration"></a> [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 |
4345

main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ resource "scaleway_object_bucket" "this" {
33
name = var.name
44
object_lock_enabled = var.versioning_enabled
55

6+
region = var.region
7+
project_id = var.project_id
8+
69
versioning {
710
enabled = var.versioning_enabled
811
}
@@ -11,7 +14,8 @@ resource "scaleway_object_bucket" "this" {
1114
resource "scaleway_object_bucket_lock_configuration" "this" {
1215
count = var.versioning_enabled ? 1 : 0
1316

14-
bucket = scaleway_object_bucket.this.name
17+
bucket = scaleway_object_bucket.this.name
18+
project_id = var.project_id
1519

1620
rule {
1721
default_retention {

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ variable "name" {
99
type = string
1010
}
1111

12+
variable "project_id" {
13+
description = "ID of the project the bucket is associated with. If null, ressources will be created in the default project associated with the key."
14+
type = string
15+
default = null
16+
}
17+
18+
variable "region" {
19+
description = "Region in which the bucket should be created. Ressource will be created in the region set at the provider level if null."
20+
type = string
21+
default = null
22+
}
23+
1224
variable "versioning_enabled" {
1325
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."
1426
type = bool

0 commit comments

Comments
 (0)