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

Error putting object in S3 bucket (): InvalidParameter: 1 validation error(s) found. - minimum field size of 1, PutObjectInput.Bucket. #9503

Closed
ghost opened this issue Jul 25, 2019 · 5 comments · Fixed by #9591
Labels
enhancement Requests to existing resources that expand the functionality or scope. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@ghost
Copy link

ghost commented Jul 25, 2019

This issue was originally opened by @hdryx as hashicorp/terraform#22210. It was migrated here as a result of the provider split. The original body of the issue is below.


Hi,

I have a Lambda module that uploads a ZIP file to S3 using aws_s3_bucket_object function.
This works fine for my project until today when i'm using small ZIP files under 1KB.
I had this error when i tried to execute my code:

> Error: Error putting object in S3 bucket (): InvalidParameter: 1 validation error(s) found.- minimum field size of 1, PutObjectInput.Bucket.

As far as i now the minimum size of an object PUT in S3 is 0KB, so why Terraform is not able to upload the ZIP ?

Terraform Version

0.12.3

Terraform Configuration Files

resource "aws_s3_bucket_object" "object" {
  bucket = "${var.s3_bucket_sources}"
  key    = "lambda/${var.function_name}/lambda.zip"
  source = "${path.module}/sources/${var.source_code}"

  # Used to trigger updates when source code changes
  etag = "${filemd5("${path.module}/sources/${var.source_code}")}"

}

Debug Output

Error: Error putting object in S3 bucket (): InvalidParameter: 1 validation error(s) found.

  • minimum field size of 1, PutObjectInput.Bucket.

Actual Behavior

It looks like Terraform is not able to upload files with size less that 1 KB

@hdryx
Copy link

hdryx commented Jul 25, 2019

Please delete this ticket, it was a problem with the name of the Bucket because it was empty. So it's not related to file size.
Thanks.

@bflad
Copy link
Contributor

bflad commented Jul 25, 2019

Hi @hdryx 👋 Thank you for reporting this and for following up here with the extra details. It seems like we might want to introduce plan time validation for that parameter so at least it ensures that a non-empty string is provided.

For anyone interested in implementing it, adding ValidateFunc: validation.NoZeroValues on the bucket and key attributes in the aws_s3_bucket_object would resolve this. 👍

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/s3 Issues and PRs that pertain to the s3 service. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 25, 2019
@bflad bflad added this to the v2.23.0 milestone Aug 7, 2019
@bflad
Copy link
Contributor

bflad commented Aug 7, 2019

The validation for this has been merged and will release with version 2.23.0 of the Terraform AWS Provider, in the next day or two. Thanks to @vedsmand for the implementation. 👍

@ghost
Copy link
Author

ghost commented Aug 7, 2019

This has been released in version 2.23.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link
Author

ghost commented Nov 2, 2019

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants