Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(#82): handle provider version as list in .terraform.lock.hcl #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

@harlemtraveler
Copy link
Contributor

@harlemtraveler harlemtraveler commented Jun 21, 2025

Description

This PR resolves a TypeError that occurs when .terraform.lock.hcl contains the version field as a string, but recent versions of Terraform may emit the value as a list. This causes a TypeError within the get_provider_version_from_lock_file() function.

.terraform.lock.hcl content

provider "registry.terraform.io/hashicorp/aws" {
 version = "5.100.0"

Error returned from /bin/tflocal

TypeError: expected string or bytes-like object, got 'list'

Fix

This fix checks for a list and safely parses the first element if necessary.

bentsku reacted with eyes emoji
@harlemtraveler harlemtraveler changed the title (削除) fix(tflocal): handle provider version as list in .terraform.lock.hcl (削除ここまで) (追記) fix(#82): handle provider version as list in .terraform.lock.hcl (追記ここまで) Jun 21, 2025
@bentsku bentsku self-requested a review June 30, 2025 14:30
Copy link
Contributor

bentsku commented Jul 1, 2025
edited
Loading

(削除) Hello @harlemtraveler and thanks for a lot for the contribution! It seems the CI is failing with the change, but I'm not too sure why.
Could you please share how to reproduce the issue so maybe we could add a test case for it, or that I could reproduce the issue myself?
I've tried running the CI on the main branch and it passed, so I suppose this change is breaking something but not too sure why without a reproducer. Thanks! (削除ここまで)

edit: I'm currently trying it out locally, and trying to run the CI again to see if it's a real issue. Will keep you updated 👍

CI is now green, I wonder what happened 😄

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this seems like a fair change! Thanks for providing a fix, and welcome to the contributors! 🙏

@bentsku bentsku merged commit 0ea14b3 into localstack:main Jul 3, 2025
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bentsku bentsku bentsku approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /