Open lkysow opened 5 years ago
We faced this issue last week when updated to Atlantis v0.8.0, and solved it by executing the custom commands with the project-specific Terraform version like this:
- run: terraform$ATLANTIS_TERRAFORM_VERSION
@lkysow I think it might be a bit more annoying that having to specify the path where the version you want lives in your workflow.
If the version you request is not downloaded yet, it looks like it won't be available for the custom workflow.
Is there any way to force the download in the custom workflow ?
For the docker image, It also looks like newly downloaded binaries are added in /home/atlantis/.atlantis/bin/
which is not in PATH
.
Meaning that depending on if you plan to use a downloaded binary or one available by default with the default docker image, you'd need to have some logic to find where the binary is. @nikovirtala 's solution wouldn't work for binaries downloaded by atlantis
We should add /home/atlantis/.atlantis/bin/
to the PATH before exec'ing.
Do you mean in the docker-entrypoint.sh
file ? If yes, I'm happy submitting a PR for that.
For the other issue ( the binary not being downloaded ), do you want me to create another bug ?
I was thinking doing it in the actual run_step_runner because we shouldn't assume everyone's using our Docker image.
RE bug, yes that sounds good as another ticket.
RE bug, yes that sounds good as another ticket.
Was this ticket opened?
RE bug, yes that sounds good as another ticket.
Was this ticket opened?
it is now, sorry for the delay
@lkysow
I've been taking a quick look at the run_step_runner
solution you were taking about , the issue I have is that we'd need to have access to the UserConfig.DataDir
( which is where it looks like the binaries are downloaded )
It doesn't look like run_step_runner
has an easy access to that.
My implementation thoughts:
TerraformClient
BinDir() string
that returns the bin dirRunStepRunner
called TerraformBinDir
server/server.go
, where RunStepRunner
is constructed, set TerraformBinDir
to terraformClient.BinDir()
That makes sense to me. Let me try to take a stab at this
Seems that projects listed in repository atlantis.yaml
do not respect Terraform version stated in versions.tf
.
Is that expected behaviour? For a time being I had to set TF version explicitly in atlantis.yaml
to bypass that problem.
I use custom workflow, but without custom commands for plan/apply.
If you use
terraform
in your custom workflow, exAtlantis won't use the version of terraform specified via
terraform_version
. Instead it is just runningsh -c "terraform init"
so whatever binary is calledterraform
will be used. To use the correct version (for now) you need to actually specify the path to where Atlantis downloads it: