cloudtools / stacker

An AWS CloudFormation Stack orchestrator/manager.
http://stacker.readthedocs.io/en/stable/
BSD 2-Clause "Simplified" License
711 stars 167 forks source link

base64 lookup contents are repr'd as byte strings causing AWS to reject it #693

Closed phrohdoh closed 5 years ago

phrohdoh commented 5 years ago

I encountered this when creating an AWS::AutoScaling::LaunchConfiguration in a CloudFormation template with UserData coming from a file on-disk.

In stacker.yaml:

UserData: ${file base64:file://userdata/asg-mount-efs.bash}

Results in the following being passed to the template as a parameter:

b'mybase64text'

Instead of the expected:

mybase64text
russellballestrini commented 5 years ago

@Phrohdoh are you running stacker with Python 3?

russellballestrini commented 5 years ago

My guess is the issue is in this function (parameterized_codec):

https://github.com/cloudtools/stacker/blob/master/stacker/lookups/handlers/file.py#L149-L171

phrohdoh commented 5 years ago

Yes, Python 3.7.1.

jklobo commented 5 years ago

Were you able to work around this issue? I'm seeing the exact same behavior

russellballestrini commented 5 years ago

@xiaket do you mind taking a look at this defect? Seems to only happen with Python 3.

troyready commented 5 years ago

@jklobo can you put together a reproduction example? gist the stacker config and template/file lookup files?

acmcelwee commented 5 years ago

I fixed this in https://github.com/cloudtools/stacker/pull/742