From 0647345217177d4125d31018b88aed8e3b79cae2 Mon Sep 17 00:00:00 2001 From: Benoit Garcia Date: Mon, 1 Apr 2024 18:55:21 +0200 Subject: [PATCH] feat: Add tags management. --- README.md | 1 + main.tf | 1 + variables.tf | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 56163f0..e18b391 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ module "my_bucket" { | [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 | +| [tags](#input_tags) | A list of tags for the bucket. As the Scaleway console does not support key/value tags, tags are written with the format value/value. | `list(string)` | `[]` | 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 d5f2935..4c52271 100644 --- a/main.tf +++ b/main.tf @@ -5,6 +5,7 @@ resource "scaleway_object_bucket" "this" { region = var.region project_id = var.project_id + tags = zipmap(var.tags, var.tags) versioning { enabled = var.versioning_enabled diff --git a/variables.tf b/variables.tf index ec3552e..cae049b 100644 --- a/variables.tf +++ b/variables.tf @@ -27,6 +27,12 @@ variable "region" { default = null } +variable "tags" { + description = "A list of tags for the bucket. As the Scaleway console does not support key/value tags, tags are written with the format value/value." + type = list(string) + default = [] +} + 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