Skip to content

Instantly share code, notes, and snippets.

@tamsky
Forked from lorengordon/TfExternal.py
Created February 15, 2018 01:34
Show Gist options
  • Save tamsky/2a325dd41f92e378039d7b782dc68b70 to your computer and use it in GitHub Desktop.
Save tamsky/2a325dd41f92e378039d7b782dc68b70 to your computer and use it in GitHub Desktop.
Python helper for a Terraform External provider
import json
class TfExternal(object):
"""Wrap Terraform External provider."""
@staticmethod
def query_args(obj):
"""Load json object from stdin."""
return {} if obj.isatty() else json.load(obj)
@staticmethod
def out_json(result):
"""Print result to stdout."""
print(json.dumps(result))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment