Skip to content

--tf-download-url is not respected since 0.28.2 #5544

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

Open
daftping opened this issue Apr 23, 2025 · 1 comment
Open

--tf-download-url is not respected since 0.28.2 #5544

daftping opened this issue Apr 23, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@daftping
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

After refactoring in this PR #4494 the --tf-download-url flag is no longer respected.

Reproduction Steps

Configure custom terraform download URL

- server
- --tf-download-url="https://artifactory.company.com/artifactory/hashicorp-remote"

Trigger the Atlantis plan for the version which needs to be downloaded.

Logs

atlantis-0 atlantis {"level":"debug","ts":"2025-04-23T04:34:06.361Z","caller":"tfclient/terraform_client.go:306","msg":"Found required_version setting of \"1.11.4\"","json":{"repo":"Org/repo","pull":"105"}}
atlantis-0 atlantis {"level":"error","ts":"2025-04-23T04:34:16.363Z","caller":"tfclient/terraform_client.go:326","msg":"error listing available versions: Get \"https://releases.hashicorp.com/terraform/index.json\": context deadline exceeded","json":{"repo":"Org/repo","pull":"105"},"stacktrace":"github.com/runatlantis/atlantis/server/core/terraform/tfclient.(*DefaultClient).DetectVersion\n\tgithub.com/runatlantis/atlantis/server/core/terraform/tfclient/terraform_client.go:326\ngithub.com/runatlantis/atlantis/server/events.(*DefaultProjectCommandContextBuilder).BuildProjectContext\n\tgithub.com/runatlantis/atlantis/server/events/project_command_context_builder.go:127\ngithub.com/runatlantis/atlantis/server/events.(*CommandScopedStatsProjectCommandContextBuilder).BuildProjectContext\n\tgithub.com/runatlantis/atlantis/server/events/project_command_context_builder.go:66\ngithub.com/runatlantis/atlantis/server/events.(*DefaultProjectCommandBuilder).buildAllCommandsByCfg\n\tgithub.com/runatlantis/atlantis/server/events/project_command_builder.go:542\ngithub.com/runatlantis/atlantis/server/events.(*DefaultProjectCommandBuilder).BuildPlanCommands\n\tgithub.com/runatlantis/atlantis/server/events/project_command_builder.go:276\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).BuildPlanCommands.func1\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:38\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).buildAndEmitStats\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:71\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).BuildPlanCommands\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:35\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).run\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:186\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:299\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:401"}

Environment details

Additional Context

I tracked it down to this call stack, which uses the default URL.
https://github.com/runatlantis/atlantis/blob/main/server/core/terraform/distribution.go#L128
https://github.com/hashicorp/hc-install/blob/main/releases/versions.go#L61
https://github.com/hashicorp/hc-install/blob/main/internal/releasesjson/releases.go#L59

@daftping daftping added the bug Something isn't working label Apr 23, 2025
Copy link

dosubot bot commented Apr 23, 2025

Hello @daftping! I'm Dosu, here to assist you with any bugs, questions, or contributions you have in mind. While you're waiting for a human maintainer, feel free to share your concerns, and I'll do my best to help!

The issue you're experiencing with the --tf-download-url flag not being respected after the refactoring in PR #4494 seems to be related to the defaulting behavior in the code. The DistributionTerraform struct in distribution.go is responsible for managing the Terraform version downloading process, and it appears that the logic defaults to the standard HashiCorp URL instead of using the custom URL provided [1].

The hc-install library, which is used for handling Terraform installations, also plays a role in this process. It seems that the Versions struct in the hc-install library might be defaulting to the standard URL for version retrieval, as indicated by the references to the versions.go and releases.go files [2][1].

To address this issue, you might need to investigate the specific logic in the distribution.go file around line 128, as well as the interaction with the hc-install library, to ensure that the custom URL is being correctly passed and utilized.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

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

No branches or pull requests

1 participant