Skip to content

Commit eadb95d

Browse files
author
Nils
authored
Merge pull request DataDog#79 from richid/show-kms-exceptions
Allow KMS exceptions to bubble up
2 parents ee9688a + 3593643 commit eadb95d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

aws/logs_monitoring/lambda_function.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,13 @@
3939

4040
# DD_API_KEY: Datadog API Key
4141
DD_API_KEY = "<your_api_key>"
42-
try:
43-
if "DD_KMS_API_KEY" in os.environ:
44-
ENCRYPTED = os.environ["DD_KMS_API_KEY"]
45-
DD_API_KEY = boto3.client("kms").decrypt(
46-
CiphertextBlob=base64.b64decode(ENCRYPTED)
47-
)["Plaintext"]
48-
elif "DD_API_KEY" in os.environ:
49-
DD_API_KEY = os.environ["DD_API_KEY"]
50-
except Exception:
51-
pass
42+
if "DD_KMS_API_KEY" in os.environ:
43+
ENCRYPTED = os.environ["DD_KMS_API_KEY"]
44+
DD_API_KEY = boto3.client("kms").decrypt(
45+
CiphertextBlob=base64.b64decode(ENCRYPTED)
46+
)["Plaintext"]
47+
elif "DD_API_KEY" in os.environ:
48+
DD_API_KEY = os.environ["DD_API_KEY"]
5249

5350
# Strip any trailing and leading whitespace from the API key
5451
DD_API_KEY = DD_API_KEY.strip()

0 commit comments

Comments
 (0)