From a675dc254830ceaad683f2bff8849b21e059b98d Mon Sep 17 00:00:00 2001 From: baryal1299 Date: Tue, 8 Sep 2020 08:34:19 -0400 Subject: [PATCH] KMS lookups give values $VAL wrapped as "b'$VAL'" when using python 3 Decrypted string is returned as b'text' which should be decoded to utf-8. --- stacker/lookups/handlers/kms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stacker/lookups/handlers/kms.py b/stacker/lookups/handlers/kms.py index ba80d2779..922fd311f 100644 --- a/stacker/lookups/handlers/kms.py +++ b/stacker/lookups/handlers/kms.py @@ -64,4 +64,4 @@ def handle(cls, value, **kwargs): decoded = codecs.decode(value, 'base64') # decrypt and return the plain text raw value. - return kms.decrypt(CiphertextBlob=decoded)["Plaintext"] + return kms.decrypt(CiphertextBlob=decoded)["Plaintext"].decode('utf-8')