feat(object module): Detection of content type #249
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR implements a feature to detect the content type based in the value of the key set to the object once uploaded. It uses a mime types DB used by a JS library with great adoption which bases the definitions mainly in
IANA
standards. There is a local copy of the DB that can be used, and an optional variable that allows to download a DB when running terraform.If
content_type
variable is set, everything is disabled.Motivation and Context
Often when uploading s3 objects to s3 through terraform resources it is difficult to dynamically set the content type of the object, specially when iterating with
fileset
. Content type is quite important in certain scenarios, for example when using the bucket as a website (the Content-Type header sent in the HTTP header to the client will rely on this).Breaking Changes
There is a new dependency of the
hashicorp/http
provider in order to be able to expose theon demand query
of the DB feature. It is not a breaking change but a new dependency that existing environments might have conflicts with.How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectsBased in the
examples/object
, many of the possible combinations of variables to create an object have been successfully deployed:pre-commit run -a
on my pull request