diff --git a/README.md b/README.md
index 4bd9fa2..7462543 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,7 @@ In the above diagram, you can see the components and their relations (PostgreSQL
|------|-------------|------|---------|:--------:|
| [bucket\_prefix](#input\_bucket\_prefix) | Prefix used for S3 buckets | `string` | `""` | no |
| [buckets\_lifecycles](#input\_buckets\_lifecycles) | Lifecycle rules for buckets | `map(string)` | `{}` | no |
+| [buckets\_versioning](#input\_buckets\_versioning) | Versioning for buckets | `map(bool)` | `{}` | no |
| [cluster\_name](#input\_cluster\_name) | EKS cluster name where you want to deploy the release | `string` | n/a | yes |
| [database\_password](#input\_database\_password) | Password to access PostgreSQL database | `string` | n/a | yes |
| [gitlab\_chart\_version](#input\_gitlab\_chart\_version) | Version of the gitlab chart | `string` | `"7.8.1"` | no |
diff --git a/examples/main.tf b/examples/main.tf
index 2352b84..0a54ede 100644
--- a/examples/main.tf
+++ b/examples/main.tf
@@ -65,6 +65,10 @@ EOF
}
EOF
}
+ # Default is `false`, determine for each of backup, lfs, artifacts, packages, uploads etc
+ buckets_versioning = {
+ backup = true
+ }
values = [
templatefile("values.yaml", {
diff --git a/main.tf b/main.tf
index 89484ac..af20b16 100644
--- a/main.tf
+++ b/main.tf
@@ -230,7 +230,7 @@ module "s3_bucket" {
force_destroy = false
versioning = {
- enabled = false
+ enabled = try(var.buckets_versioning[each.key], false)
}
policy = data.aws_iam_policy_document.s3_bucket_policy[each.key].json
diff --git a/variables.tf b/variables.tf
index c9f7dd7..71611b1 100644
--- a/variables.tf
+++ b/variables.tf
@@ -95,6 +95,12 @@ variable "buckets_lifecycles" {
default = {}
}
+variable "buckets_versioning" {
+ description = "Versioning for buckets"
+ type = map(bool)
+ default = {}
+}
+
variable "tags" {
description = "A map of tags to add to all resources"
type = map(string)