fix: pass strip_string_quotes to hcl2.load() for python-hcl2 v8.x compat#96
fix: pass strip_string_quotes to hcl2.load() for python-hcl2 v8.x compat#96
strip_string_quotes to hcl2.load() for python-hcl2 v8.x compat#96Conversation
There was a problem hiding this comment.
Thanks for jumping on this! I believe there was a community contribution that had started to fix this as well with #94
Do you think it'd be possible to cherry pick their commit to keep their contribution, as they also updated the changelog and the requirements which are missing from this PR? 👍
Let me know if you'd like me to cherry pick that commit, I can do it, merge then do a release
…l2 v8 compat strip_string_quotes alone is not sufficient — python-hcl2 v8 also injects __is_block__ and __comments__ metadata keys into parsed dicts, which leak into generated .tf override files causing "argument not expected" errors. Also update tests to use the same SerializationOptions when parsing override files.
9241683 to
371a15c
Compare
| from hcl2 import SerializationOptions # noqa: E402 | ||
|
|
||
| HCL2_SERIALIZATION_OPTIONS = SerializationOptions( |
There was a problem hiding this comment.
this is mostly a note for later and not something actionable for this PR: I don't know if we explicitly set some versions on hcl2 for some reasons, and if we're aiming of compatibility. There could be a world when we want to keep compatibility with older versions, and would have to try to import the SerializationOptions and fallback if it failed, and pass some kwargs to load.
But I think hcl2>=8 is just the right version to use, so we can see later, I think we'll need to rework how we package this!
Summary
iotanalyticsandioteventsendpoints to always be included in the generated override file, even for AWS provider v6.xwhere they were removed
SerializationOptions(strip_string_quotes=True)to allhcl2.load()calls in bothbin/tflocalandtests/test_apply.py