Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ ADDITIONAL_TF_OVERRIDE_LOCATIONS=/path/to/module1,path/to/module2 tflocal plan

## Change Log

* v0.26.0: Fix compatibility with `python-hcl2` v8+ by using `SerializationOptions(strip_string_quotes=True)` to handle quoted dict keys
* v0.25.0: Improve `s3control` local endpoint override and respect `AWS_ENDPOINT_URL` configuration for `mwaa`
* v0.24.1: Exclude broken `python-hcl2` version from requirements
* v0.24.0: Add support to return `terraform-local` version when calling `tflocal -version` and fix AWS provider detection
Expand Down
7 changes: 5 additions & 2 deletions bin/tflocal
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ if os.path.isdir(os.path.join(PARENT_FOLDER, ".venv")):

from localstack_client import config # noqa: E402
import hcl2 # noqa: E402
from hcl2 import SerializationOptions # noqa: E402

HCL2_SERIALIZATION_OPTIONS = SerializationOptions(strip_string_quotes=True)

DRY_RUN = str(os.environ.get("DRY_RUN")).strip().lower() in ["1", "true"]
DEFAULT_REGION = "us-east-1"
Expand Down Expand Up @@ -611,7 +614,7 @@ def parse_tf_files() -> dict:
for _file in glob.glob("*.tf"):
try:
with open(_file, "r") as fp:
result[_file] = hcl2.load(fp)
result[_file] = hcl2.load(fp, serialization_options=HCL2_SERIALIZATION_OPTIONS)
except Exception as e:
print(f'Unable to parse "{_file}" as HCL file: {e}')
return result
Expand All @@ -634,7 +637,7 @@ def get_provider_version_from_lock_file() -> Optional[version.Version]:

provider_version = None
with open(lock_file, "r") as fp:
result = hcl2.load(fp)
result = hcl2.load(fp, serialization_options=HCL2_SERIALIZATION_OPTIONS)
for provider in result.get("provider", []):
for provider_name, provider_config in provider.items():
if provider_name.endswith(AWS_PROVIDER_NAME_SUFFIX):
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = terraform-local
version = 0.25.0
version = 0.26.0
url = https://github.com/localstack/terraform-local
author = LocalStack Team
author_email = info@localstack.cloud
Expand Down Expand Up @@ -28,7 +28,7 @@ packages = find:

install_requires =
localstack-client
python-hcl2!=7.3.0
python-hcl2>=8
packaging

[options.extras_require]
Expand Down
Loading