-
Notifications
You must be signed in to change notification settings - Fork 540
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
On module "buckets", using action type "SetStorageClass" on the "lifecycle_rules" is not working #263
Comments
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
Let me know if you need further information |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
Any new on this? |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
. |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
. |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
. |
TL;DR
Using module "buckets" when I specify a type different from "delete" or "AbortIncompleteMultipartUpload" terraform plan always fail with error "Error: googleapi: Error 400: Invalid argument., invalid"
Uncommenting type = "Delete" and commenting type = "SetStorageClass" and storageClass = "NEARLINE" terraform apply works fine:
locals {
buckets = {
"stream360" = { # Name of the bucket prefix
names = ["videos"] # Name of the bucket suffix
labels = {
environment = local.environment
}
lifecycle_rules = [{
action = {
type = "Delete"
#type = "SetStorageClass"
#storageClass = "NEARLINE"
}
condition = {
age = 60
}
}]
location = upper(var.region)
versioning = {
first = true
}
storage_class = "STANDARD"
public_access_prevention = "enforced"
randomize_suffix = true
set_admin_roles = true
set_viewer_roles = true
bucket_policy_only = {
"videos" = true
}
}
}
}
module "buckets" {
for_each = local.buckets
source = "terraform-google-modules/cloud-storage/google"
prefix = each.key
project_id = local.project_id
names = each.value.names
randomize_suffix = each.value.randomize_suffix
labels = each.value.labels
lifecycle_rules = each.value.lifecycle_rules
location = each.value.location
versioning = each.value.versioning
storage_class = each.value.storage_class
public_access_prevention = each.value.public_access_prevention
set_admin_roles = each.value.set_admin_roles
set_viewer_roles = each.value.set_viewer_roles
bucket_policy_only = each.value.bucket_policy_only
depends_on = [module.projects_iam_bindings]
}
Expected behavior
Bucket is created with lifecycle based on SetStorageClass
Observed behavior
Error on terraform apply:
"Error: googleapi: Error 400: Invalid argument., invalid"
Terraform Configuration
Terraform Version
Terraform v1.3.7 on linux_amd64 + provider registry.terraform.io/hashicorp/external v2.3.1 + provider registry.terraform.io/hashicorp/google v4.51.0 + provider registry.terraform.io/hashicorp/google-beta v4.51.0 + provider registry.terraform.io/hashicorp/null v3.2.1 + provider registry.terraform.io/hashicorp/random v3.5.1 Your version of Terraform is out of date! The latest version is 1.5.3. You can update by downloading from https://www.terraform.io/downloads.html
Additional information
Creating lifecycle directly on Google Console works without any issue
I also noticed from the examples available that using module "cloud_storage" lifecycle rule using action type "SetStorageClass" seems to work
The text was updated successfully, but these errors were encountered: