Skip to content

python-hcl2 >= 8.0.0 silently breaks tflocal — dependency version constraint missing #95

@wrchen-ef

Description

@wrchen-ef

Problem

terraform-local currently has no upper bound on python-hcl2 in its dependencies.
When users upgrade to python-hcl2 >= 8.0.0, tflocal init silently skips S3 backend
handling when python-hcl2 >= 8.0.0 is installed.

What Breaks

python-hcl2 v8 introduced a breaking change in parsed output format
(PR #203):
block labels now include surrounding quotes in the dict key ("s3"'"s3"').

This causes generate_s3_backend_config() to silently skip S3 backend handling:

  • get_or_create_bucket() is never called
  • No LocalStack S3 endpoint is injected into the override file
  • tflocal apply creates resources successfully (provider override is unaffected),
    then fails on state upload with NoSuchBucket

The failure is particularly confusing because resources appear to succeed before the error.

Expected Behavior

Either:

  • terraform-local pins python-hcl2 < 8.0.0 until full v8 compatibility is implemented, or
  • A new release with v8 support is published promptly after python-hcl2 v8 is released

Publishing a new version of a library without updating dependency constraints
for breaking upstream changes leaves users silently broken with no obvious path to debug.

Fix

PR #94 already implements
v8 compatibility using SerializationOptions(strip_string_quotes=True).
Please move forward with the progress.

Versions Affected

  • terraform-local: 0.24.x, 0.25.x
  • python-hcl2: 8.0.0 – 8.1.1

Workarounds before fix

Option 1 — Pin python-hcl2 < 8.0.0

Option 2 — Add to xxxx.hcl directly (xxxx.hcl is passed via --backend-config
and never parsed by tflocal's hcl2.load(), so hcl2 v8 doesn't affect it):

endpoint                    = "http://localhost:4566"
force_path_style            = true   # avoids virtual-hosted DNS issue with localhost

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions