Closed WebSpider closed 3 years ago
Hi @WebSpider!
Thank you for reporting this.
It is documented in the API description: https://www.backblaze.com/b2/docs/lifecycle_rules.html
A bucket can have up to 100 lifecycle rules. Each rule has a fileNamePrefix that specifies which files in the bucket it applies to. Any file whose name starts with the prefix is subject to the rule. A prefix of the empty string, "", means that the rule applies to all files in the bucket.
WARNING: This means that a lifecycle rule with fileNamePrefix of the empty string could potentially delete ALL files in a bucket, so please tread carefully.
Probably because of the potentially destructive operation of "empty" fileNamePrefix
, this field must be explicitly set when working with the raw API and the B2 CLI:
$ b2 create-bucket --lifecycleRules='[{"daysFromHidingToDeleting": 1, "daysFromUploadingToHiding": 7}]' my-name allPublic
ERROR: required field fileNamePrefix is missing (bad_request)
The provider documentation only mentions that the parameter is required: https://registry.terraform.io/providers/Backblaze/b2/latest/docs/resources/bucket#nested-schema-for-lifecycle_rules We are working on improving the provider documentation as it is still in beta. Every contributions are welcome
Best regards, Maciej Lech
Will we fix it in b2-sdk-python with a client-side exception?
Will we fix it in b2-sdk-python with a client-side exception?
Backblaze/b2-sdk-python#188
Hi!
It turns out file_name_prefix is currently required when you want to set a lifecycle_rule, however:
How to replicate:
Try and apply it .. the error returns:
Used terraform version: 0.13.5