Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import JSON Templates #468

Merged
merged 9 commits into from
Apr 20, 2016
Merged

Import JSON Templates #468

merged 9 commits into from
Apr 20, 2016

Conversation

jonapich
Copy link
Contributor

This new Template subclass makes it possible to import most Cloudformation templates as JSON and parse them as Troposphere objects. This is different from cfn2py in that it's not trying to write actual python code, but rather instantiate the actual objects without the need to edit it afterwards.

There are probably a few tropo-specific AWSHelperFns that won't be parsed correctly, but the ones included in the tests/examples_output are all supported. I believe an effort should be done to normalize the helper functions into something discoverable with a consistent use - but I have yet to really ponder on that issue.

This prototype is able to take all the expected outputs (from the tests)
and generate the Template() from them. Not all objects are used in those
expected templates, so there are likely some features missing still.
It is not possible to validate against AWSHelperFn such as Ref, so this
typecheck is superfluous. Changing to basestring.
@markpeek
Copy link
Member

Thanks!

@jonapich jonapich deleted the import-cfn-json branch April 25, 2016 20:35
webratz pushed a commit to webratz/troposphere that referenced this pull request May 4, 2016
* cloudtools/master: (80 commits)
  Add test for AWS::Logs::Destination (cloudtools#482)
  Fix baseclass for AWS::Logs::Destination (Fixes cloudtools#481)
  Update for changes since 1.5.0
  Fix Bucket AccessControl to allow Ref (cloudtools#475)
  Better AWSHelperFn support in template generator (cloudtools#473)
  Implement LifecycleRule Transitions property (cloudtools#472)
  Update to Apr 25, 2016 release (cloudtools#471)
  Fix Source object to take a list of SourceDetails (cloudtools#469)
  Update Contribute Document to Use Requirements.txt (cloudtools#470)
  Add WAF SizeConstraintSet and XssMatchSet
  Add backward compatibility for the deprecated ElasticsearchDomain
  Fix Elasticsarch Domain object naming
  Import JSON Templates (cloudtools#468)
  ReplicationConfigurationRules Destination is now an object (cloudtools#380)
  Remove unnecessary AWSHelperFn from props
  EC2 update FromPort, ToPort and Egress as optional
  Added CloudWatch Events support
  ApiGateway Resources (cloudtools#466)
  Provide Valid Lambda Function Memory Values for use in Parameters (cloudtools#449)
  move Groups to property, add policy template version (cloudtools#460)
  ...
amosshapira pushed a commit to amosshapira/troposphere that referenced this pull request Oct 24, 2016
This new Template subclass makes it possible to import most Cloudformation templates as JSON and parse them as Troposphere objects. This is different from cfn2py in that it's not trying to write actual python code, but rather instantiate the actual objects without the need to edit it afterwards.

There are probably a few tropo-specific AWSHelperFns that won't be parsed correctly, but the ones included in the tests/examples_output are all supported. I believe an effort should be done to normalize the helper functions into something discoverable with a consistent use - but I have yet to really ponder on that issue.
markpeek pushed a commit that referenced this pull request Dec 26, 2016
The use of dictionary comprehension in #468 caused support for Python
2.6 to be dropped. This change converts these comprehensions to use
simple iteration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants