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

feat: s3 object-lifecycle-rule to support different syntaxes for filter block #66

Merged
merged 3 commits into from
Jan 9, 2024

Conversation

h1manshu98
Copy link
Member

what

  • filter block syntax to support both syntaxes in aws_s3_bucket_lifecycle_configuration
    Syntax-1
resource "aws_s3_bucket_lifecycle_configuration" "example" {
  ....
    filter {
      prefix = "logs/"
    }
  ...
}

Syntax-2 (with and )

resource "aws_s3_bucket_lifecycle_configuration" "example" {
  ...
    filter {
      and {
        tags = {
          Key1 = "Value1"
          Key2 = "Value2"
        }
      }
    }
  ...
}

why

  • Previously, only and {} syntax was supported which is causing below XML error when applying terraform.

ERROR
│ Error: updating S3 Bucket Lifecycle Configuration (test-s3-bucket): operation error S3: PutBucketLifecycleConfiguration, https response error StatusCode: 400, RequestID: 9AXXXXXXXXXXJQ, HostID: BU6BxxxxxxxxxxQWVQ/XMrSRnaNrF/RFNQumxxxxxxxxxxxuJ0DRYpUCxxxxxxxxxx=, api error MalformedXML: The XML you provided was not well-formed or did not validate against our published schema

│ with module.test_s3_bucket.aws_s3_bucket_lifecycle_configuration.default[0],
│ on .terraform/modules/test_s3_bucket/main.tf line 287, in resource "aws_s3_bucket_lifecycle_configuration" "default":
│ 287: resource "aws_s3_bucket_lifecycle_configuration" "default" {

References -

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration
https://github.com/terraform-aws-modules/terraform-aws-s3-bucket/tree/master

@h1manshu98 h1manshu98 requested a review from a team December 29, 2023 14:07
@clouddrove-ci clouddrove-ci self-assigned this Dec 29, 2023
@h1manshu98 h1manshu98 self-assigned this Dec 29, 2023
@h1manshu98 h1manshu98 added the bug Something isn't working label Dec 29, 2023
variables.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
Copy link
Member

@vaibhav7797 vaibhav7797 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@themaniskshah themaniskshah merged commit 197ff64 into master Jan 9, 2024
39 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feat/s3-lifecycle-rule-configuration branch January 9, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants