Open tibuntu opened 6 months ago
Did it actually made it into the release?
I had a quick look inside the container:
> docker run -ti --entrypoint /bin/sh ghcr.io/runatlantis/atlantis:v0.27.2
/ $ which terraform
/usr/local/bin/terraform
/ $ terraform --version
Terraform v1.6.3
on linux_amd64
Your version of Terraform is out of date! The latest version
is 1.7.5. You can update by downloading from https://www.terraform.io/downloads.html
That's strange, we have it working for Terraform 1.7...
From the docs:
The highest version of Terraform allowed in your code is the version specified by DEFAULT_TERRAFORM_VERSION in the image your server is running.
Is that perhaps set somewhere on the image you're running?
If we check a commit from which the latest release was built, there is still a 1.6 version of Terraform being used - https://github.com/runatlantis/atlantis/blob/v0.27.2/Dockerfile#L6. That said, I think the simplest thing is to have your own image based on atlantis one and update terraform at your own pace. You can copy terraform installation from atlantis image for example.
But if you run the stock image, with that environment variable set to a higher version, it will download the requested version. That's the behaviour I see on our implementation.
That is true, but only for default workflow. If you are using custom workflows there is no auto-download. Which in itself may as well be a bug :)
You need to run /atlantis-data/bin/terraform${ATLANTIS_TERRAFORM_VERSION}
and not just terraform
(which is the one baked into the image) in your custom workflow.
Hello everyone, thank you for all the feedback!
@stasostrovskyi that was a very good hint, and I agree that this might be something to debate :)
Thanks to the input from @peikk0, I was able to adapt our custom workflow:
workflows:
default_workflow:
plan:
steps:
- run: /atlantis-data/bin/terraform${ATLANTIS_TERRAFORM_VERSION} init -upgrade -input=false
- run: /atlantis-data/bin/terraform${ATLANTIS_TERRAFORM_VERSION} plan -input=false -refresh -out $PLANFILE
apply:
steps:
- run: /atlantis-data/bin/terraform${ATLANTIS_TERRAFORM_VERSION} apply $PLANFILE
and adapted our Helm values to use a specific version that we want to use by providing defaultTFVersion: 1.7.4
Now we can control which version to use via Helm, and Atlantis correctly downloads the desired version!
@paulbailey @nitrocode any more remarks or inputs? From my perspective this can be closed.
That's how I also run terraform for what it's worth.
I've always been able to run every terraform release using the autodownload via required_version
and the workflow using ATLANTIS_TERRAFORM_VERSION
.
It might be worth changing this ticket to Document how to use the version in "required_version"
if it's not already documented.
Having to use terraform${ATLANTIS_TERRAFORM_VERSION}
is a bit odd. For my use case, we need a custom workflow because we run only one instance, but we deploy in 2 different GCP projects, which requires 2 different Service Accounts. Then we use:
plan:
steps:
- env:
name: GOOGLE_IMPERSONATE_SERVICE_ACCOUNT
value: <service_account_email>
We never had issues with different TF versions before, but since last update, it started to fail with the same error @tibuntu reported.
│ Error: Unsupported Terraform Core version
│
│ on versions.tf line 2, in terraform:
│ 2: required_version = "=1.7.4"
│
│ This configuration does not support Terraform version 1.6.3. To proceed,
│ either choose another supported Terraform version or update this version
│ constraint. Version constraints are normally set for good reason, so
│ updating the constraint may lead to other errors or unexpected behavior.
And I really wouldn't like to have to set this terraform${ATLANTIS_TERRAFORM_VERSION}
. Any other workaround that could prevent us from having to set this atlantis tf version variable?
@ricardosilva86 are you saying that 0.27.2 has a regression and 0.27.1 worked as expected without using terraform${ATLANTIS_TERRAFORM_VERSION}
in your workflow ?
Community Note
Overview of the Issue
Even though these changes: https://github.com/runatlantis/atlantis/pull/4203 made it into the most recent version
v0.27.2
Atlantis is still not able to handle Terraform version 1.7.xReproduction Steps
Have a
versions.tf
like:then simply run
atlantis plan
(See logs below)Logs
Environment details
v0.27.2
Atlantis server-side config file:
Repo
atlantis.yaml
file: