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

v1.1.0 does not parse tf version constraint correctly #410

Closed
AkiraKane opened this issue Apr 25, 2024 · 5 comments · Fixed by #403
Closed

v1.1.0 does not parse tf version constraint correctly #410

AkiraKane opened this issue Apr 25, 2024 · 5 comments · Fixed by #403
Assignees
Labels
enhancement Refactor existing code for better performance and quality

Comments

@AkiraKane
Copy link

Hey! I was running the GHA in our repo. which is to download tfswitch. After that, I got an error shows that

warrensbox/terraform-switcher info found version: 1.1.0 for v1.1.0/linux/amd64
warrensbox/terraform-switcher info installed /usr/local/bin/tfswitch
21:39:51.820 INFO Reading version from Terraform module at "tf"  
21:39:51.852 INFO Reading required version from constraint: "= ~>1.3.9"  
21:39:51.852 ERROR No version found matching "= ~>1.3.9"  
21:39:51.852 FATAL Error parsing configuration file: "error parsing constraint: Malformed constraint: = ~>1.3.9"  

However, yesterday ran the older version, did not have this error:

warrensbox/terraform-switcher info found version: 1.0.2 for 1.0.2/linux/amd64
warrensbox/terraform-switcher info installed /usr/local/bin/tfswitch
Reading required version from terraform file
Reading required version from constraint: ~>1.3.9
Matched version: 1.3.10
Creating directory for terraform binary at: /home/runner/.terraform.versions
Downloading to: /home/runner/.terraform.versions
19989918 bytes downloaded
Switched terraform to version "1.3.10" 

Any ideas how to parse the version constraint with v1.1.0?

@AkiraKane AkiraKane added the enhancement Refactor existing code for better performance and quality label Apr 25, 2024
@yermulnik yermulnik linked a pull request Apr 25, 2024 that will close this issue
@yermulnik
Copy link
Collaborator

@AkiraKane Thanks for reporting. We're already aware of this "bug": #403

  • Quick fix: update the value of required_version in your HCL file to have ~> 1.3.9 instead of ~>1.3.9 (put the space between constraint operator and version string)
  • Or temporary downgrade to previous version of tfswitch and wait for the next tfswitch release that will ship the fix 🤷🏻

@AkiraKane
Copy link
Author

gotcha, Thanks!

@AkiraKane
Copy link
Author

AkiraKane commented Apr 25, 2024

@yermulnik Sorry, one more question, since I am using this command curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash to install the latest package in the workflow file, just wondering if there is a way I can still use this command to install the previous version of the package, like 1.0.2?

@yermulnik
Copy link
Collaborator

@AkiraKane Run it like this:

curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash -s -- 1.0.2

@AkiraKane
Copy link
Author

@yermulnik Awesome. gotta try that. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Refactor existing code for better performance and quality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants