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

google_storage_bucket lifecycle_rule throwing List shorter than MinItems error #9215

Closed
joeyorlando opened this issue May 23, 2021 · 3 comments · Fixed by GoogleCloudPlatform/magic-modules#4809, #9221 or hashicorp/terraform-provider-google-beta#3282
Assignees
Labels

Comments

@joeyorlando
Copy link

joeyorlando commented May 23, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

0.15.4

Provider Version

3.68.0

Affected Resource(s)

  • google_storage_bucket (lifecycle_rule attribute specifically)

Terraform Configuration Files

resource "google_storage_bucket" "stitchdata" {
  name           = "<my_bucket_name_here>"
  storage_class  = "STANDARD"
  location       = "US"
  requester_pays = false

  lifecycle_rule {
    action {
      type = "Delete"
    }
    condition {
      age                        = 7
      days_since_custom_time     = 0
      days_since_noncurrent_time = 0
      matches_storage_class      = []
      num_newer_versions         = 0
      with_state                 = "ANY"
    }
  }

  labels = local.labels
}

Debug Output

Waiting for the plan to start...

Terraform v0.15.4
on linux_amd64
Configuring remote state backend...
Initializing Terraform configuration...
╷
│ Error: List shorter than MinItems
│
│   with google_storage_bucket.stitchdata,
│   on gcs_stitchdata.tf line 11, in resource "google_storage_bucket" "stitchdata":
│   11:     condition {
│
│ Attribute supports 1 item minimum, config has 0 declared

Panic Output

Expected Behavior

The plan should successfully complete

Actual Behavior

Received above debug output mentioning that my lifecycle_rule block is not properly configured when in fact it should be

Steps to Reproduce

  1. terraform plan (with above configuration)

Important Factoids

References

@edwardmedia edwardmedia self-assigned this May 23, 2021
@edwardmedia
Copy link
Contributor

API takes empty array of matches_storage_class

@joeyorlando
Copy link
Author

that did the trick. I was importing this google_storage_bucket resource and the terraform plan prior to the import showed matches_storage_class = []. Omitting matches_storage_class fixed things for me, thank you.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.