cloudtools / cloudtools/troposphere
Allow AWSObject instances to be assigned to properties
- Dominant language
- Python
- Stars
- 4.9k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
The current pattern in troposphere is something like:
template.add_resource(SomeResource("ResourceName", VpcId=Ref(vpc_instance)))
Almost any time you are going to add a local variable containing an AWSObject as a property to another object, you are likely going to be adding a Ref
It seems to me that the 'Ref' construct in cfn JSON is a way of handling variables in JSON. So while the template is existing logically in Python - why not let these references exist as regular python references.
I have an initial WIP here which converts to Ref() on **setitem**:
https://github.com/ptone/troposphere/compare/assume-refs?expand=1
But I'd actually like to see the resolving of this into a Ref, come later, right before serialization to json.
Maybe templates can have a some sort of pre to_json hook that can do this resolving?
Contributor guide
Assessment
This issue has not been assessed yet.