Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to configure "Keep only the last version of the file" lifecycle rule #46

Closed
jglopez opened this issue Jul 1, 2023 · 3 comments
Closed

Comments

@jglopez
Copy link

jglopez commented Jul 1, 2023

If a B2 bucket has its lifecycle settings configured to "Keep only the last version of the file" via the web interface:
image

Then the provider will unnecessarily require that file_name_prefix be defined and will always instead want to create a custom lifecycle rule.
Error from terraform plan:

╷
│ Error: Missing required argument
│ 
│   on redacted.tf line 6, in resource "b2_bucket" "redacted":
│    6:   lifecycle_rules {
│ 
│ The argument "file_name_prefix" is required, but no definition was found.
╵

Steps to reproduce

  1. Create B2 bucket via web interface
  2. Configure lifecycle settings: Keep only the last version of the file
  3. Import B2 bucket into Terraform state: terraform import b2_bucket.example [bucket_id]
  4. Run terraform plan
  5. See that terraform requires that file_name_prefix is defined

Version info

$ terraform -v
Terraform v1.5.2
on linux_amd64
+ provider registry.terraform.io/backblaze/b2 v0.8.4
@jglopez
Copy link
Author

jglopez commented Jul 1, 2023

Whoops! Sorry, just realized this was already reported 🤦

Duplicate of #3

@colans
Copy link

colans commented Oct 16, 2024

Even with better documentation, this is still really broken. See #85 .

@mlech-reef
Copy link
Collaborator

As stated in #3, fileNamePrefix is required to be an empty string in order to apply the rules to every file in the bucket - that why this parameter is required which is aligned with the B2 API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants