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

Any content in terragrunt.hcl other than "terraform_version_constraint" causes tfswitch to error #401

Closed
violet-hall opened this issue Apr 25, 2024 · 7 comments · Fixed by #409 · May be fixed by #264
Closed

Any content in terragrunt.hcl other than "terraform_version_constraint" causes tfswitch to error #401

violet-hall opened this issue Apr 25, 2024 · 7 comments · Fixed by #409 · May be fixed by #264
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@violet-hall
Copy link

violet-hall commented Apr 25, 2024

Since this morning the following snippet:

terragrunt_version_constraint = "= 0.36.2"
terraform_version_constraint = "= 0.14.0"

Causes this output:

tfswitch --log-level=DEBUG
12:10:34.729 INFO [terragrunt.go:20,GetVersionFromTerragrunt] Reading configuration from "/redacted/terragrunt.hcl"  
12:10:34.729 FATAL [parameters.go:70,GetParameters] Error parsing configuration file: "could not decode body of HCL file \"/redacted/terragrunt.hcl\""  

However running like so:

terraform_version_constraint = "= 0.14.0"

Works as expected:

tfswitch --log-level=DEBUG                                                              ─╯
12:09:11.331 INFO [terragrunt.go:20,GetVersionFromTerragrunt] Reading configuration from "/redacted/terragrunt.hcl"  
12:09:11.331 DEBUG [list_versions.go:19,getTFList] Get list of terraform versions  
12:09:11.420 INFO [semver.go:14,GetSemver] Reading required version from constraint: "= 0.14.0"  
12:09:11.421 INFO [semver.go:42,SemVerParser] Matched version: "0.14.0"  
12:09:11.421 INFO [install.go:257,installableBinLocation] Installing terraform at "/home/redacted/bin"  
12:09:11.421 INFO [install.go:307,InstallVersion] Switched terraform to version "0.14.0" 

I've seen similar issues here this morning but they seem to be different outputs

@violet-hall violet-hall added the enhancement Refactor existing code for better performance and quality label Apr 25, 2024
@violet-hall
Copy link
Author

Sorry I forgot to specify this is using a .hcl file not a .tf to configure versions

@violet-hall
Copy link
Author

For now as a workaround I have:

  1. Downgraded to version 1.0.2 to avoid this issue
  2. Used the install script from commit 6950928 as the latest install script throws a 404 referencing older versions due to the syntax change

@violet-hall
Copy link
Author

violet-hall commented Apr 25, 2024

The line that throws the error:

return params, fmt.Errorf("could not decode body of HCL file %q", filePath)

Note that this doesn't actually output the error so I can't fix whatever is allegedly wrong with my file

@yermulnik yermulnik added bug Something isn't working and removed enhancement Refactor existing code for better performance and quality labels Apr 25, 2024
@MatrixCrawler MatrixCrawler linked a pull request Apr 25, 2024 that will close this issue
@MatrixCrawler
Copy link
Collaborator

The PR #264 could probably adress this issue. Unfortunately (due to lack of activity here) the PR was never finished and is outdated.
Personally i am struggling with implementing the terragrunt parser so any help with that is very welcome.

@yermulnik
Copy link
Collaborator

For now as a workaround I have:

  1. Downgraded to version 1.0.2 to avoid this issue
  2. Used the install script from commit 6950928 as the latest install script throws a 404 referencing older versions due to the syntax change

FYI: #405

@MatrixCrawler MatrixCrawler linked a pull request Apr 25, 2024 that will close this issue
@warrensbox
Copy link
Owner

warrensbox commented Apr 25, 2024

The PR #264 could probably adress this issue. Unfortunately (due to lack of activity here) the PR was never finished and is outdated. Personally i am struggling with implementing the terragrunt parser so any help with that is very welcome.

I will see what I can do.

@MatrixCrawler Do you know if #264 resolves this issue? I haven't had the chance to test this yet

@MatrixCrawler
Copy link
Collaborator

@warrensbox #409 will fix that definitely. in regards of #264 i am unsure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
4 participants