You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
resource"google_storage_bucket""sql-backup" {
count="${length(var.sql_buckets)}"name="${lookup(var.sql_buckets[count.index], "bucket_name")}"project="${var.project}"location="${lookup(var.sql_buckets[count.index], "bucket_location")}"storage_class="REGIONAL"labels {
project="${lookup(var.sql_buckets[count.index], "instance_project")}"instance="${lookup(var.sql_buckets[count.index], "instance_name")}"
}
# Add a rule to delete objects older than delete_days input# Reference on deletions: https://cloud.google.com/storage/docs/lifecyclelifecycle_rule {
"action" {
type ="Delete"
}
"condition" {
age ="${lookup(var.sql_buckets[count.index], "delete_days")}"
}
}
lifecycle {
prevent_destroy="true"
}
}
Expected Behavior
Reading the documentation the is_live parameter is not required for un-versioned buckets. Hence when I set the delete_days var to 10 I expect objects to be deleted after 10 days, as the bucket is not versioned.
is_live - (Optional) Relevant only for versioned objects.
Example output from gsutil lifecycle get <bucket> with my current hcl config.
Because is_live defaults to false, it fills in the lifecycle rule with 'Archived'. Hence it does not match any objects in my bucket because it is un-versioned.
Steps to Reproduce
Steps untested, but given as guidance:
Export these vars:
export TF_VAR_NAME="<some bucket name>"export TF_VAR_PROJECT="<some google project>"
This documentation should be changed. Something like the following may be more appropriate:
is_live - (Optional) Defaults to 'false' to match archived objects. If true, this condition matches live objects. Unversioned buckets have only live objects.
The text was updated successfully, but these errors were encountered:
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!
ghost
locked and limited conversation to collaborators
Nov 18, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Reading the documentation the
is_live
parameter is not required for un-versioned buckets. Hence when I set thedelete_days
var to10
I expect objects to be deleted after 10 days, as the bucket is not versioned.Example output from
gsutil lifecycle get <bucket>
with my current hcl config.Actual Behaviour
Objects are not being deleted after 10 days.
Because
is_live
defaults to false, it fills in the lifecycle rule with 'Archived'. Hence it does not match any objects in my bucket because it is un-versioned.Steps to Reproduce
Steps untested, but given as guidance:
main.tf
:terraform plan ..
andterraform apply
and then upload a file to the bucket.Check file is present and the lifecycle rule is set:
Important Factoids
The google documentation is not exactly clear when you are not using versioning on an object. You can see here that it is stated:
References
I raised an issues on google cloud issue tracker to verify that the
isLive
parameter does matter for un-versioned buckets.Reccomedation
This documentation should be changed. Something like the following may be more appropriate:
The text was updated successfully, but these errors were encountered: