Giter Club home page Giter Club logo

terraform-aws-s3's Issues

lifecycle rule malformed xml when using only prefix and no tags for filter due to "and" block

Describe the bug
The module fails with a malformed XML whne you try to terraform apply a lifecycle rule with a prefix but no tags. It happens because it is coded in a way that the filter field always starts with an "and": https://github.com/Coalfire-CF/terraform-aws-s3/blob/main/main.tf#L130-L131

To Reproduce
Steps to reproduce the behavior: Create a lifecycle rule with only prefix, no tags.

Expected behavior
Successful lifecycle rule creation.

Screenshots

│ Error: updating S3 Bucket Lifecycle Configuration (fedco-images): operation error S3: PutBucketLifecycleConfiguration, https response error StatusCode: 400, RequestID: 3N66EYQFVXJ4QKWT, HostID: BA4hCQ7FsDsdHEY2l/TZr30pX+YOv4a1oJGhwX+8nw0urj/p2GtpyryNHBi/+v0toLzkYNVwMTE=, api error MalformedXML: The XML you provided was not well-formed or did not validate against our published schema

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

Additional context
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration#example-usage
I believe this issue stemmed out of trying to get around a bug where "filter" was required, even if empty, but it seems not to be required anymore.

Add more examples on how to use this module in the Readme

This module could be improved by having example code in the readme showing how to use the module. Some ideas:

  • Create a s3 bucket that is encrypted using KMS keys
  • Create a s3 bucket with lifecycle policies turned on and configured
  • Create a s3 bucket with a specific folder structure

Fix `key_iam` output variable

Describe the bug
Name of output key_iam is deceptive. This name needs updated OR the output value needs changed.

To Reproduce
outputs.tf file

output "key_iam" {
  value       = join("", aws_s3_bucket.s3_default[*].bucket_domain_name)
  description = "The Domain of the s3 bucket."
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.