runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.8k stars 1.05k forks source link

When using different terraform version in atlantis.yaml , it gives an error "Unsupported Terraform Core version" #3639

Open khatib-moh opened 1 year ago

khatib-moh commented 1 year ago

Community Note


Overview of the Issue

If not already included, please provide the following:

Atlantis server-side config file: repos:

Any other information you can provide about the environment/deployment (efs/nfs, aws/gcp, k8s/fargate, etc) --->

Additional Context

khatib-moh commented 1 year ago

Hi , i think that the description is missing from the issue , i don't know why , anyway my issue is when i use terraform_version in atlantis and use a custom workflow at the same time like the below atlantis.yaml:

version: 3 projects:

it gives me an error related to the core version , it only works after i add this to the custom workflow

Thanks,

nokernel commented 1 year ago

@khatib-moh Is there a required_version in the terraform module(s) HCL that you are trying to apply?

artburkart commented 1 year ago

I'm experiencing the same thing. I'm trying to figure out why this happens. Unfortunately, we'd upgraded from Atlantis 0.19 to 0.25, so I can't tell where the bug is introduced, but without any changes to our configurations, we're seeing output like this after the upgrade:

Error: Unsupported Terraform Core version

  on remote-config.tf line 2, in terraform:
   2:   required_version = "1.3.5"

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.
artburkart commented 1 year ago

Oh, I think I understand what happened. At some point, between 0.19 and 0.25, I think Atlantis got more strict about the required_version block, and if you have it defined twice, it returns nil for the detected version, and that means it uses the default installed version instead of the one defined in the project.

jamengual commented 1 year ago

yes we did change the behaviour to be more strict but we introduced a bug where the default version is not being selected.