localstack / localstack/terraform-local

Unable to determine version for terraform v0.12.31

Open
#63 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
323
Forks
44
PR merge metrics
No merged PRs in 30d

Description

I know this is an old version of Terraform but it does block using `tflocal` with the Terraform version I have to use - if there are other issues with older versions of Terraform maybe it's worth documenting a minimum version.

### Description
```
$ tfenv use 1.9.8
Switching default version to v1.9.8
Default version (when not overridden by .terraform-version or TFENV_TERRAFORM_VERSION) is now: 1.9.8
$ tflocal
Usage: terraform [global options] [args]
...

$ tfenv use 0.12.31
Switching default version to v0.12.31
Default version (when not overridden by .terraform-version or TFENV_TERRAFORM_VERSION) is now: 0.12.31
$ tflocal
Unable to determine version. See error message for details: Expecting value: line 1 column 1 (char 0)
```

It looks like it's because the version is parsed from `terraform version -json` [here](https://github.com/localstack/terraform-local/blob/main/bin/tflocal#L467), but it doesn't work for `v0.12.31`:
```
$ tfenv use 1.9.8
Switching default version to v1.9.8
Default version (when not overridden by .terraform-version or TFENV_TERRAFORM_VERSION) is now: 1.9.8
$ terraform version -json
{
"terraform_version": "1.9.8",
"platform": "darwin_arm64",
"provider_selections": {},
"terraform_outdated": false
}

$ tfenv use 0.12.31
Switching default version to v0.12.31
Default version (when not overridden by .terraform-version or TFENV_TERRAFORM_VERSION) is now: 0.12.31
$ terraform version -json
Terraform v0.12.31

Your version of Terraform is out of date! The latest version
is 1.9.8. You can update by downloading from https://www.terraform.io/downloads.html
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with bin/tflocal around line 467 and reproduce the reported difference between Terraform 1.9.8 and v0.12.31 using `terraform version -json`. Check how the version output is parsed, then verify the expected behavior for the older release or document the minimum supported Terraform version; done means the limitation or compatibility behavior is clear and tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
terraform
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.