terraform-aws-modules / terraform-aws-s3-bucket

Terraform module to create AWS S3 resources 🇺🇦

Home Page:https://registry.terraform.io/modules/terraform-aws-modules/s3-bucket/aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to get abort_incomplete_multipart_upload_days working with lifecycle_rule

prashanthparsi opened this issue · comments

Description

I'm using terraform-aws-modules/terraform-aws-s3-bucket for creating S3 bucket and while defining lifecycle_rule, I am passing abort_incomplete_multipart_upload_days = 7. Terraform is unable to process that. I am getting below error.

Error: Error putting S3 lifecycle: InvalidRequest: AbortIncompleteMultipartUpload cannot be specified with Tags.
status code: 400, request id: GH54RNPMTPKAS8WN, host id: iNTwBVIqtCD0kC6ExcoE7ttr9ApqHPGk9lUmSWJOtAZgHfxqPq7mu0S5oW1zm4kR1rccarqh018=

Per Terraform docs, it should be defined at lifecycle_rule tag level -> https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket#lifecycle_rule

Please let me know how to fix this?

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Terraform: v0.13.7
  • Module: provider registry.terraform.io/hashicorp/aws v3.56.0

Reproduction

Steps to reproduce the behavior:

Yes Yes

terraform init
terraform plan
terraform apply

Code Snippet to Reproduce

   {
     id                                     = "test-id"
     abort_incomplete_multipart_upload_days = 7
     enabled                                = true
     prefix                                 = "model-builder/"

     tags = {
       rule      = "test-lifecycle-rule"
       autoclean = "true"
     }

     transition = [
       {
         days          = 30
         storage_class = "ONEZONE_IA"
       }
     ]

     expiration = {
       days = 60
     }

     noncurrent_version_expiration = {
       days = 60
     }
   }
 ] 
## Expected behavior
Lifecycle Rule should respect abort_incomplete_multipart_upload_days

## Actual behavior
Getting Error - 
Error: Error putting S3 lifecycle: InvalidRequest: AbortIncompleteMultipartUpload cannot be specified with Tags.
   status code: 400, request id: GH54RNPMTPKAS8WN, host id: iNTwBVIqtCD0kC6ExcoE7ttr9ApqHPGk9lUmSWJOtAZgHfxqPq7mu0S5oW1zm4kR1rccarqh018=

### Terminal Output Screenshot(s)
![image](https://user-images.githubusercontent.com/6187189/131744755-e2ec9707-dda5-458d-acc1-d5e4de342ea3.png)

Hi,

Looks like you can't do this in AWS and Terraform AWS provider documentation don't tell this. See this note in the official AWS documentation - https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-configuration-examples.html#lc-expire-mpu

Note:
When specifying the AbortIncompleteMultipartUpload Lifecycle action, the rule cannot specify a tag-based filter.

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.