-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Unable to override required_version
terraform version using a flag
#3199
Comments
We saw this issue also on |
What you probably want to use is https://www.runatlantis.io/docs/terraform-versions.html#via-terraform-config |
that breaks original funcitonality where The bug is that default terraform version does not do anything to help out. |
required_version
terraform version using a flag
can you show your atlantis.yaml? just one project is fine. This does not break functionality; we match the same way TF does version requirements. how are you defining your provider versions? |
I think he's saying that he wants to set a global default terraform version using Whereas the current workflow in I personally do not agree with this suggestion. Plus you can use a custom workflow to run any terraform version you like. You can hard code it if you like. - run: |
terraform1.3.9 plan |
I apologise for my lack of understanding here. I am also having a hard time seeing why atlantis needs to manage terraform versions for you? Thats outside the scope of the tool is it not? Consider most CI workflows are all running on pretty much custom images that have all their inputs controlled. i.e. we set the atlantis version in our docker image, we set the terragrunt version, we set the terraform version. If atlantis randomly starts using differnt version of terraform why doesnt atlantis just update itself at this point and use latest for everything? I am not understanding why atlantis needs to control the tf version for you? end users need that right in normal workflows, not only in custom ones surely? Secondly with overriding tf version through
Weve clearly hit some issue here though. I have set the Default version, so the plan perhaps picks up the version So if we have a fork of terraform we cannot run it unless its a custom workflow? I apologies but i fail to see how this is not a breaking change? My atlantis.yaml needs a rerite to make our forked tf work now. thats a breaking change surely? I am simply asking for a contingency where a user can simply use a specified tf version in all usecases. Currently its inconsistent, do you not agree? Why would
So setting that would allow the policy check command to use But also if that is the case i dont understand what these variables are for and they dont work as their naming implies. They clearly dont default for all commands. They are confusing as there are two of those variables. Differences are confusing to end users, why is there a need for both? Can they be just be removed? Setting tf version explicitly though atlantis yaml and implicitly through
I hope this is constructive feedback and it doesnt feel like an atttack. Just would like to get better understanding |
@ekhaydarov I hear you and I understand the frustration so let's try to find a solution. how long have you used atlantis, specifically what version? Atlantis downloads the TF version specified in On my terraforms project in this company and others we always have a version.tf like so :
and in some cases, we only allow one version only, especially if is a monorepo and in that case the atlantis.yaml and the version.tf looks the same as for the |
Perhaps we need a new flag such as this?
It can default to true unless specified as false. By enabling this potential flag, atlantis will stop reading the |
Thanks for understanding and suggesting a workaround. Just double checking that when autodownload is set to false then when commands are run they simply reference |
Thank you for the ticket @ekhaydarov . We ran into the same issue! I only noticed when my |
Same here today. We use atlantis since quite some time and this change was very surprising. I also tried the different environment variables to pin a specific terraform version and also used |
It seems to be correct that the But more important! I tried to constrain the required_version on one module like that: |
That is indeed odd. For me, I've been able to use If you folks think we should have a new flag to respect the @steveizzle The atlantis version will need to be 0.23.0 or later for the |
Another flag that could be added to allow downloading but give it a maximum version so there is a central place where the tf version can be controlled
Both of the above could default to empty strings to maintain the current workflow |
Just to add to the discussion - we've used Atlantis for a while and up until recently using atlantis with below req version:
Would give you the tf version from With atlantis upgrade this now defaults to latest TF which breaks a lot of our projects. Some option to keep old functionality in place would be good. Setting req version to specific still worked like so :
So are we saying the old behaviour worked due to a bug that was fixed with : #3153 |
No, the old behaviour worked due to the required_version not being respected before atlantis version |
It is clearly explained above that atlantis is not a terraform version manager. To summarise:
Now you are stating that atlantis was broken before 0.23.0 which adds to my opinion about this being a breaking change and needing to be announced as one. We are going round in circles now. Happy for this issue to be muted/closed and myself or someone with a more imperative need implement @nitrocode suggestion they outlined below:
|
Facing the same issue.
We have ATLANTIS_DEFAULT_TF_VERSION set to 1.2.1. Now with the latest image 0.24.4, the atlantis plan always picks the 1.5.3 terraform version and ignore the tf version setting which broke all our existing projects planning. |
Feel free to push a PR if anyone wants to work on this fix. |
Is this related to why I am getting this error despite me setting the required_version in terraform? After I got this I also set the environment variable ATLANTIS_DEFAULT_TF_VERSION in the container and it's still not working.
|
yes.
…On Fri, Aug 25, 2023 at 9:58 PM Will Swinson ***@***.***> wrote:
Is this related to why I am getting this error despite me setting the
required_version in terraform? After I got this I also set the environment
variable ATLANTIS_DEFAULT_TF_VERSION in the container and it's still not
working.
Error: Unsupported Terraform Core version
│
│ on versions.tf line 2, in terraform:
│ 2: required_version = "1.3.7"
│
│ This configuration does not support Terraform version 1.5.5. 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.
—
Reply to this email directly, view it on GitHub
<#3199 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERGDF5TQ24QSGMQTAZLXXF67XANCNFSM6AAAAAAVWG2ZNI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I am facing the same issue as @willswinson , it seems to only affect steps that are using the
Is there any workaround for this at the moment? @jamengual |
the workaround is to set the terraform_version at the workflow level, you can override the default workflow if you are not setting workflows |
@jamengual like what is mentioned here? |
yes |
who is willing to make a PR to solve this? |
Community Note
Overview of the Issue
A new atlantis feature automatically tries to manage terraform versions for you, downloads the latest version for you and runs that instead. For repos that have floating version requirements like
>=1.3
that means atlantis will try to download and use 1.4.0 for you and run that even if your state file is in 1.3.9. this should have been documented as a breaking changeThe issue occurs when you have a policy check after a plan. The plan can run in tf 1.3.9 but the policy_check will run in a different terraform version, in this case 1.4.0 was released so atlantis tries to be clever and use the latest version. Of course that fails because the state file is in tf 1.3.9.
Looking at the docs I have tried setting the default version with these envs but they do nothing for the policy_check part.
What does one need to do in order to turn off this "feature" completely and let us control what terraform version is being run? If not possible what flag / option is there to override the tf version to make sure that a consistent and same version is used at all times in all places?
Reproduction Steps
required_version
like>=1.3
.Environment details
Atlantis server-side config file:
Repo
atlantis.yaml
file: its 16k lines. can provide relevant info if neededThe text was updated successfully, but these errors were encountered: