ITADN

feat: Switch TF/Tofu version parsing from HTML to JSON

#741Openyermulnik 创建于 2026-04-17
enhancement
Y
yermulnikcommented
**Is your feature request related to a problem? Please describe.** To get the list of available TF/Tofu versions, currently the HTML endpoints are parsed (see `DefaultMirror` at https://github.com/warrensbox/terraform-switcher/blob/master/lib/product.go#L169-L197), which implies burden on tracking changes to HTML representation of the versions list (as it is meant for humans rather than for automation). Moreover we allow custom mirrors that might have their very own representation format (e.g. #311). **Describe the solution you'd like** Switch from parsing HTML to querying JSON: * Terraform: https://releases.hashicorp.com/terraform/index.json * OpenTofu: https://get.opentofu.org/tofu/api.json ⚠️ **Caveat**: custom mirrors like Artifactory or similar might not have a JSON endpoint exposed (which we might work around by keeping HTML parser logic for such cases though 🤔) **Describe alternatives you've considered** None as proven by #738 **Additional context** #311 (#313), #738 (#739), probably more.
0 条评论