You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, referring to a Variable object prevents the stack to be serialized:
$ terraformpy
terraformpy - Processing: main.tf.py
terraformpy - Writing main.tf.json
Traceback (most recent call last):
File "/private/tmp/terraformpy-bug/.venv/bin/terraformpy", line 10, in<module>sys.exit(main())
File "/private/tmp/terraformpy-bug/.venv/lib/python3.8/site-packages/terraformpy/cli.py", line 46, in main
json.dump(compile(), fd, indent=4, sort_keys=True)
File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 179, in dump
forchunkin iterable:
File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
[Previous line repeated 1 more time]
File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Variable is not JSON serializable
I am trying to add a secret to Google Secret Manager (GCP).
The secret will come from a variable defined in Terraform Enterprise (see https://www.hashicorp.com/blog/variable-management-in-terraform-cloud/ for more details).
However, referring to a
Variable
object prevents the stack to be serialized:Context
Using python3 on OSX:
Repro steps
The script:
The steps:
Workaround
The workaround I am using is to manually "serialize" the variable:
But that defeats the purpose of using a python object.
The text was updated successfully, but these errors were encountered: