Skip to content

Conversation

@Rwwn
Copy link

@Rwwn Rwwn commented Feb 24, 2025

I've been trying this tool out, and it's giving a funny response for the latest available Terraform version:

terraform FAILED Outdated major version
────────────────────────────────────────────────────────────────────────────────

  Resolution
  ───────────────────────────────────────────────────────────────────
  Consider migrating to the latest major version of terraform

  Details
  ───────────────────────────────────────────────────
  Type:                terraform
  Path:                /src/terraform/terragrunt/provider-version-monitor
  Name:                terraform
  Source:              github.com/hashicorp/terraform
  Version Constraints: = 1.8.4
  Version:             
  Latest Match:        1.8.4
  Latest Overall:      20240919.0.0

────────────────────────────────────────────────────────────────────────────────
-------------

Did some digging and found that 20240919 is the name of a branch on the hashicorp/terraform repo. Looks to me that the Git function in the versions package is pulling down a list of all refs from the repo, which includes branch names as well as tags. It then attempts to create a version number from each of those, skipping those that aren't parsable as version numbers. Problem with that approach is that a branch name can be anything, so if it's anything resembling a version number, it will be parsed as a version number.

The filterTerraformTags function already filters out two branches which have been erroneously found as tags by this logic, so I'm adding this new branch to that list as a quick fix. I've built locally and run against the TF files in the example dir to check it's working, and it does. In the long run though, it would be better to rewrite the Git function to search for only tags , and not include all refs when looking at a GitHub repo. Given that this project seems to be abandoned and my PR is therefore unlikely to be merged, I'm not going to spend my time on that right now, and instead write my own tool for this. I'll just leave this here in case anyone hits the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant