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

please grant me write access to this repo so that I can submit a pr to bump the tf version #665

Closed
brandon-dacrib opened this issue Jun 7, 2019 · 12 comments
Labels
question Further information is requested

Comments

@brandon-dacrib
Copy link
Contributor

Since the version in the image is 0.12 and the current downloadable version is 0.12.1 new users will get the following error:

exit status 1: running "terraform init -input=false -no-color" in "/home/atlantis/.atlantis/repos/meetup/variant/618/default/tf/monitoring":

Initializing the backend...
Error refreshing state: state snapshot was created by Terraform v0.12.1, which is newer than current v0.12.0; upgrade to Terraform v0.12.1 or greater to work with this state

We need to keep these in sync.

@lkysow
Copy link
Member

lkysow commented Jun 7, 2019

@brandon-dacrib run Atlantis with the flag --default-tf-version=0.12.1 or the environment variable ATLANTIS_DEFAULT_TF_VERSION

Also you don't need write access to this repo to make a change, fork it and create a pull request: https://help.github.com/en/articles/fork-a-repo

@lkysow lkysow closed this as completed Jun 7, 2019
@lkysow lkysow added the question Further information is requested label Jun 7, 2019
@brandon-dacrib
Copy link
Contributor Author

thx

@brandon-dacrib
Copy link
Contributor Author

Setting the ATLANTIS_DEFAULT_TF_VERSION=0.12.1 environment variable fails because it looks like the ATLANTIS_DEFAULT_TF_VERSION variable isn't used anywhere in the current docker image however DEFAULT_TERRAFORM_VERSION here. I will sort out how to fork and send a PR, these should match the current reality.

@brandon-dacrib
Copy link
Contributor Author

confirmed that it is not downloading 0.12.1 and these are the only versions that exist; I will continue with the fork and pr path 0.10.8
0.11.14
0.12.0
0.8.8
0.9.11

@brandon-dacrib
Copy link
Contributor Author

After looking at this more I realized that this approach would never have worked because the different versions of terraform are installed at build time, not run time. We need to update the version installed then to be current, I have done so in this PR #667

@lkysow
Copy link
Member

lkysow commented Jun 7, 2019

@brandon-dacrib I can assure you that that environment variable is respected :D I wrote Atlantis so I would know!

docker run -e ATLANTIS_DEFAULT_TF_VERSION=0.12.1 runatlantis/atlantis server --gh-user=foo --gh-token=bar --repo-whitelist='*'
2019/06/07 21:40:47+0000 [WARN] cmd: No GitHub webhook secret set. This could allow attackers to spoof requests from GitHub
2019/06/07 21:40:48+0000 [INFO] server: Could not find terraform version 0.12.1 in PATH or /home/atlantis/.atlantis/bin, downloading from https://releases.hashicorp.com
2019/06/07 21:40:48+0000 [INFO] server: Atlantis started - listening on port 4141
2019/06/07 21:40:49+0000 [INFO] server: Downloaded terraform 0.12.1 to /home/atlantis/.atlantis/bin/terraform0.12.1

As you can see, Atlantis downloads that version and uses it for subsequent requests. ☝️

@brandon-dacrib
Copy link
Contributor Author

Ahh the confusion here is that it downloads that version to /home/atlantis/.atlantis/bin/terraform0.12.1 where I was looking somewhere else in in the filesystem when I was running it.

@brandon-dacrib
Copy link
Contributor Author

brandon-dacrib commented Jun 25, 2019 via email

@lkysow
Copy link
Member

lkysow commented Jun 25, 2019

If you're using custom run steps you need to specify the full path to the binary (until the latest version is released that has that dir in PATH so you can just do terraform0.12.2. Another gotcha is that if you're not using any built-in steps and only using run steps, then Atlantis won't download the right terraform_version (this is a bug).

In your case, if you're just running /home/atlantis/.atlantis/bin/terraform0.12.2 init -input=false -no-color then you should be able to use the default init step:

steps:
- init

@brandon-dacrib
Copy link
Contributor Author

brandon-dacrib commented Jun 25, 2019 via email

@ghost
Copy link

ghost commented Jul 25, 2019

Another gotcha is that if you're not using any built-in steps and only using run steps, then Atlantis won't download the right terraform_version (this is a bug).

I'm affected by this bug - Is it being tracked anywhere?

@lkysow
Copy link
Member

lkysow commented Jul 25, 2019

Another gotcha is that if you're not using any built-in steps and only using run steps, then Atlantis won't download the right terraform_version (this is a bug).

I'm affected by this bug - Is it being tracked anywhere?

#675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants