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

Added S3 SSEKMSKeyId config option #3762

Merged
merged 2 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dvc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class RelPath(str):
Optional("listobjects", default=False): Bool,
Optional("use_ssl", default=True): Bool,
"sse": str,
"sse_kms_key_id": str,
"acl": str,
"grant_read": str,
"grant_read_acp": str,
Expand Down
4 changes: 4 additions & 0 deletions dvc/remote/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def __init__(self, repo, config):
if self.sse:
self.extra_args["ServerSideEncryption"] = self.sse

self.sse_kms_key_id = config.get("sse_kms_key_id")
if self.sse_kms_key_id:
self.extra_args["SSEKMSKeyId"] = self.sse_kms_key_id

self.acl = config.get("acl")
if self.acl:
self.extra_args["ACL"] = self.acl
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/remote/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ def test_grants_mutually_exclusive_acl_error(dvc, grants):

with pytest.raises(ConfigError):
S3Remote(dvc, config)


def test_sse_kms_key_id(dvc):
remote = S3Remote(dvc, {"url": url, "sse_kms_key_id": "key"})
assert remote.extra_args["SSEKMSKeyId"] == "key"