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

filter_and doesnt work when object_size_greater_than is specified #268

Open
pszczypta-autopay opened this issue Feb 19, 2025 · 0 comments
Open
Labels
bug 🐛 An issue with the system

Comments

@pszczypta-autopay
Copy link

pszczypta-autopay commented Feb 19, 2025

Describe the Bug

I am using cloudposse s3-bucket 4.10.0 version. I have set terragrunt object with following schema

  lifecycle_configuration_rules=[
	{
	  enabled = true
	  id      = "deletion_archive"
	  expiration = {
		  days  = 30
		}
	  noncurrent_version_expiration = {
		  noncurrent_days = 30
		}
		filter_and = {
			object_size_greater_than = 1
			prefix = "xxx/archive/"
		}
	}
]

When I remove the object_size_greater_than it works fine.

Following terraform output:

          ~ filter {
              + object_size_greater_than = (known after apply)
              + object_size_less_than    = (known after apply)
                # (1 unchanged attribute hidden)

              + and {
                  + object_size_greater_than = 1
                  + object_size_less_than    = (known after apply)
                  + prefix                   = "xxx/archive/"
                  + tags                     = {}
                }
            }

The error:

aws_s3_bucket_lifecycle_configuration.default[0]: Modifying... [id=xxx]
╷
│ Error: updating S3 Bucket (xxx) Lifecycle Configuration
│ 
│   with aws_s3_bucket_lifecycle_configuration.default[0],
│   on lifecycle.tf line 159, in resource "aws_s3_bucket_lifecycle_configuration" "default":
│  159: resource "aws_s3_bucket_lifecycle_configuration" "default" {
│ 
│ operation error S3: PutBucketLifecycleConfiguration, https response error
│ StatusCode: 400, RequestID: XXX, HostID:
│ XXX,
│ api error MalformedXML: The XML you provided was not well-formed or did not
│ validate against our published schema
╵
ERRO[0019] terraform invocation failed in /home/XXX/.terragrunt-cache/xxx
ERRO[0019] error occurred:

* Failed to execute "terraform apply" in /home/xxx/.terragrunt-cache/xxx
  ╷
  │ Error: updating S3 Bucket (xxx) Lifecycle Configuration
  │ 
  │   with aws_s3_bucket_lifecycle_configuration.default[0],
  │   on lifecycle.tf line 159, in resource "aws_s3_bucket_lifecycle_configuration" "default":
  │  159: resource "aws_s3_bucket_lifecycle_configuration" "default" {
  │ 
  │ operation error S3: PutBucketLifecycleConfiguration, https response error
  │ StatusCode: 400, RequestID:xxx, HostID:
  │ XXX,
  │ api error MalformedXML: The XML you provided was not well-formed or did not
  │ validate against our published schema
  ╵
  
  exit status 1

I can add that if I not specify filter at all, it not even trying to remove existing minimun object size

Expected Behavior

Update the mimimum object size object

Steps to Reproduce

Create bucket using that module and that example config

lifecycle_configuration_rules=[
{
enabled = true
id = "deletion_archive"
expiration = {
days = 30
}
noncurrent_version_expiration = {
noncurrent_days = 30
}
filter_and = {
object_size_greater_than = 1
prefix = "xxx/archive/"
}
}
]

Screenshots

No response

Environment

No response

Additional Context

No response

@pszczypta-autopay pszczypta-autopay added the bug 🐛 An issue with the system label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

1 participant