cloudtools / cloudtools/troposphere

how to use Cloudformation Parameters with Ref in UserData from_file

Open
#1,023 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
4.9k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

I'm loading the userdata from bash file that contains AWS Refs Parameters, I'm using from_file function (from helpers). For instance:

my_userdata.sh:
...
{ "Ref" : "mykey" }
...

deploy.py:
...
dir = os.path.dirname(__file__)
filepath = os.path.join(dir, 'my_scripts/')
file = os.path.join(filepath, 'my_userdata.sh')

launchconfig = t.add_resource(LaunchConfiguration(
name,
...
UserData=from_file(file, "")
))
...

When I print my json template generated from troposphere, I see unnecessary escaped characters and the stack deploy fails

print(t.to_json())
...
{ \"Ref\" : \"mykey\" }
...

Can I avoid the transformation of the Cloudformation Refs?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.