cloudtools / cloudtools/troposphere

Allow AWSObject instances to be assigned to properties

Open
#25 1 comment 0 reactions 0 assignees View on GitHub
enhancement
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

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.