Skip to content
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

Error in v1.10 parsing version #400

Closed
AndyLonghurstHESA opened this issue Apr 25, 2024 · 3 comments · Fixed by #403
Closed

Error in v1.10 parsing version #400

AndyLonghurstHESA opened this issue Apr 25, 2024 · 3 comments · Fixed by #403
Assignees
Labels
bug Something isn't working
Milestone

Comments

@AndyLonghurstHESA
Copy link

Since the latest version has been released, we have broken pipelines that cannot resolve the TF version. We did not have issue issue yesterday. It is complaining of a double = character. Checking the versions.tf we have "=1.7.5" specified.

2024/04/25 10:00:56.109010 Running command tfswitch 10:00:56.160 FATAL Error parsing configuration file: "error parsing constraint: Malformed constraint: = =1.7.5"

Versions.tf file:
required_version = "=1.7.5"

@MatrixCrawler MatrixCrawler self-assigned this Apr 25, 2024
@MatrixCrawler
Copy link
Collaborator

MatrixCrawler commented Apr 25, 2024

I cannot reproduce that in the moment.

My version.tf looks like this

terraform {
  required_version = "= 1.7.5"
}

which works fine.

Could you please run tfswitch with --log-level=DEBUG and post the output?

@MatrixCrawler
Copy link
Collaborator

I can reproduce it when there is no space between the = and the version number
Invalid version.tf

terraform {
  required_version = "=1.7.5"
}

@MatrixCrawler MatrixCrawler added the bug Something isn't working label Apr 25, 2024
@MatrixCrawler
Copy link
Collaborator

The error is here
https://github.com/warrensbox/terraform-switcher/blob/master/lib/param_parsing/versiontf.go#L44-L52

We will fix that. Thanks for pointing out.

MatrixCrawler added a commit that referenced this issue Apr 25, 2024
@MatrixCrawler MatrixCrawler linked a pull request Apr 25, 2024 that will close this issue
MatrixCrawler added a commit that referenced this issue Apr 25, 2024
* added fix for #400 when the comparator is not separated from the version number by a space
* use hashicorp version constraint checker for constraints
* added new testcase
@MatrixCrawler MatrixCrawler added this to the Release 1.1.1 milestone Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants