-
Notifications
You must be signed in to change notification settings - Fork 13
Description
I'm trying to set this up like in the Web UI:
It seems like these settings are the most appropriate:
resource "b2_bucket" "my_bucket" {
bucket_name = var.bucket_name
bucket_type = "allPrivate"
lifecycle_rules {
file_name_prefix = "" # Apply to all files
days_from_hiding_to_deleting = 0 # Immediately delete after a file is hidden
days_from_uploading_to_hiding = 0 # Never keep revisions
}
}However, when I look at the Web front-end, I it's set to custom lifecycle rules, which is different:
So I tried setting it manually, deleting it from my state, and then importing to see what the correct settings would be:
lifecycle_rules {
days_from_hiding_to_deleting = 1
days_from_uploading_to_hiding = 0
file_name_prefix = null
}But then when I try to apply that, I get:
│ Error: Missing required argument
│
│ with module.backupscale_backup.b2_bucket.backupscale_bucket,
│ on modules/backupscale_backup/object_storage.tf line 7, in resource "b2_bucket" "backupscale_bucket":
│ 7: file_name_prefix = null
│
│ The argument "lifecycle_rules.0.file_name_prefix" is required, but no definition was found.
So then I tried this:
lifecycle_rules {
days_from_hiding_to_deleting = 1
days_from_uploading_to_hiding = 0
file_name_prefix = ""
}This seems to work, as in it shows up correctly in the Web UI, but how does hiding the file for one day actually mean that files shouldn't be kept? This seems like some sort of secret magic incantation that shouldn't work, while it doesn't work the way it should. Said another way, it's extremely counter-intuitive.
Questions:
- Is it actually possible to set this intuitively from Terraform to achieve the desired behaviour?
- Will my above configuration be good enough for now, or will this keep revisions? Maybe the Web UI is misleading, even though it looks okay?
- Is Add models for corsRules and lifecycleRules instead of dicts b2-sdk-python#188 the solution to this? It's not clear to me if that's a solution to this problem, or something else.
There's another issue about this at #46, but that's just a documentation issue requiring setting file_name_prefix = "".

