-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
service/s3: setting S3 object content as base64 #3788
Conversation
* `source` - (Required) The path to the source file being uploaded to the bucket. | ||
* `content` - (Required unless `source` given) The literal content being uploaded to the bucket. | ||
* `source` - (Required unless `content` or `content_base64` is set) The path to a source file to upload to the bucket. | ||
* `content` - (Required unless `source` or `content_base64` is set) Literal content to upload into the bucket. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of Literal content
here should we say String content
/UTF8 content
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Literal" here was trying to distinguish from "filename" and "base64" rather than making a statement about what format the content is in. That is, I was trying to explain how source
is different from content
to someone who might not be familiar with either yet.
I'm not sure that "string" gets to that meaning because the base64 version and the filename are also both strings, just with different interpretations of their values.
How about this?
source
- The path to a file that will be read and uploaded as raw bytes for the object content.content
- Literal string value to use as the object content, which will be uploaded as UTF-8-encoded text.content_base64
- Base64-encoded data that will be decoded and uploaded as raw bytes for the object content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just one note from earlier about potentially fixing the documentation wording for the content
argument.
11 tests passed (all tests)
=== RUN TestAccAWSS3BucketObject_tags
--- PASS: TestAccAWSS3BucketObject_tags (8.69s)
=== RUN TestAccAWSS3BucketObject_contentBase64
--- PASS: TestAccAWSS3BucketObject_contentBase64 (8.93s)
=== RUN TestAccAWSS3BucketObject_source
--- PASS: TestAccAWSS3BucketObject_source (9.11s)
=== RUN TestAccAWSS3BucketObject_withContentCharacteristics
--- PASS: TestAccAWSS3BucketObject_withContentCharacteristics (9.34s)
=== RUN TestAccAWSS3BucketObject_content
--- PASS: TestAccAWSS3BucketObject_content (9.68s)
=== RUN TestAccAWSS3BucketObject_sse
--- PASS: TestAccAWSS3BucketObject_sse (10.35s)
=== RUN TestAccAWSS3BucketObject_updates
--- PASS: TestAccAWSS3BucketObject_updates (13.67s)
=== RUN TestAccAWSS3BucketObject_storageClass
--- PASS: TestAccAWSS3BucketObject_storageClass (15.19s)
=== RUN TestAccAWSS3BucketObject_updatesWithVersioning
--- PASS: TestAccAWSS3BucketObject_updatesWithVersioning (15.25s)
=== RUN TestAccAWSS3BucketObject_acl
--- PASS: TestAccAWSS3BucketObject_acl (15.24s)
=== RUN TestAccAWSS3BucketObject_kms
--- PASS: TestAccAWSS3BucketObject_kms (27.63s)
Generally we recommend either using "content" for small text strings generated within config (e.g. rendered templates) and "source" for larger binary content loaded from disk. This new argument allows a third case of uploading small raw binary content generated in configuration, such as the result of passing a rendered template through the base64gzip(...) interpolation function in conjunction with a content_encoding = "gzip" argument. Terraform Core does not guarantee safe passage for raw binary strings that are not valid UTF-8, so base64 is an emerging convention for the rare cases where raw byte buffers must be manipulated within the configuration language, similar to the "user_data_base64" argument to aws_instance.
55a24b7
to
43f5a8a
Compare
This has been released in version 1.12.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Generally we recommend using
content
for small text strings generated within config (e.g. rendered templates) andsource
for larger binary content loaded from disk.This new argument allows a third case of uploading small raw binary content generated in configuration, such as the result of passing a rendered template through the
base64gzip(...)
interpolation functionin conjunction with a
content_encoding = "gzip"
argument.Terraform Core does not guarantee safe passage for raw binary strings that are not valid UTF-8, so base64 is an emerging convention for the rare cases where raw byte buffers must be manipulated within the configuration language, similar to the
user_data_base64
argument to aws_instance.