-
-
Notifications
You must be signed in to change notification settings - Fork 840
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
Cannot add lifecycle rule to expire delete markers #167
Comments
This is not a bug, this is how Terraform works. All elements of the list must be of the same type. When they are objects, that means they must have all the same fields. You need to add missing fields. This should work with Terraform 1.0.0 or later: locals {
lifecycle_configuration_rules = [
{
enabled = true
id = "cleanup"
abort_incomplete_multipart_upload_days = 1
filter_and = {
prefix = "prefix/"
}
expiration = {
days = var.s3_expiration
expired_object_delete_marker = null
}
noncurrent_version_expiration = {
newer_noncurrent_versions = var.s3_expiration_noncurrent_versions
noncurrent_days = var.s3_expiration_noncurrent_days
}
transition = null
noncurrent_version_transition = null
}
,
{
enabled = true
id = "cleanup-delete-markers"
expiration = {
days = null
expired_object_delete_marker = true
}
abort_incomplete_multipart_upload_days = 1
filter_and = null
transition = null
noncurrent_version_expiration = null
noncurrent_version_transition = null
}
]
} |
That isn't true. Terraform has allowed optional fields for the last couple versions. But this is more of an improvement (feature request) than a bug, just due to it was probably written before terraform 1.3 |
The I will leave this open as a feature request. |
Found a bug? Maybe our Slack Community can help.
Describe the Bug
Attempting to add a second rule to expire delete markers. But get
The given value is not suitable for module.s3_bucket.var.lifecycle_configuration_rules declared at .terraform/modules/s3_bucket/variables.tf:159,1-41: cannot find a │ common base type for all elements.
Lifecycle rules:
The first rule works fine by itself. Error happens when second rule is added
The second rule is one I use all the time. Just first time using this module to create it
Expected Behavior
Both lifecycle rules defined
Steps to Reproduce
╷ │ Error: Invalid value for input variable │ │ on main.tf line 128, in module "s3_bucket": │ 128: lifecycle_configuration_rules = local.lifecycle_configuration_rules │ │ The given value is not suitable for module.s3_bucket.var.lifecycle_configuration_rules declared at .terraform/modules/s3_bucket/variables.tf:159,1-41: cannot find a │ common base type for all elements.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: