-
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
Specified terraform version (using required_version) not used when required_providers is specified #1153
Comments
Seems to be related to the "source" argument in the provider block |
I'm seeing this error message in the logs:
|
PRs welcome! Can someone dig into this? |
Ok, so I did a bit more digging and I think I got to the root of it. Here's what I found: The error we're seeing in the logs seems to originate here:
Looks like
Which corresponds to the required provider block in my test config (this PR: joerx/tf-sandbox#1):
Apparently the |
Is there a workaround, since #1171 hasn't been released yet? |
Hmm... I tried using the top-of-trunk atlantis, but it didn't work for me either. It seems to be ignoring the terraform required_version specification, and is not overriding the default terraform version 0.12.29 set via environment variables. By adding an atlantis.yaml via a repo config, I was able to set the right version 0.13.4, and things worked. But the docs seem to say that the specified required_version in the terraform config should be sufficient. How are you supposed to do a transition from one major version of terraform to another? We have our atlantis instance defaulting to 0.12.29 so that all the old terraform 12 stuff will still work, by default. But when trying to move to 0.13 in a specific repo, it seems to not be obeying the directives in the HCL files. |
Does the terraform required_version specification only work if specifying an exact version, not a version range, even tho that is valid there? |
Looked at the source code and answered my own question. It does not, for reasons that are unclear to me. Filed #1217. |
For what it's worth, I wrote a small wrapper around Terraform that will automatically download the correct TF version based on a semver constraint. It's here: https://github.com/joerx/tfx - we're using it in a custom workflow for Atlantis and it works reasonably well so far. |
You're scraping the HTML with a regex, right? |
Yeah. haven’t found a better way to do it yet
…Sent from my iPhone
On 12 Oct 2020, at 12:28 PM, Richard Lee ***@***.***> wrote:
will automatically download the correct TF version based on a semver constraint.
You're scraping the HTML with a regex, right?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
There is a similar project called terraform-switcher that uses the official Terraform releases list and selects the correct release based on the |
@llamahunter if you have a moment can you please make note of where in the source you found the constraint to make it easier for someone to pick up? |
I wanted to report that this still doesnt work in the latest helm chart.
Results in
We are specifying defaultTFVersion: 0.13.3 chart, and then attempting to upgrade section by section to 0.13.5, then we would bump up the default version. |
Same here @jseiser looks as blocker to proceed with custom workflows with terraform > |
#1217 is in place to fix this, but it hasn't been merged yet. |
By the way, for any people who find this issue, you can now set the required version and atlantis will download it for you. https://www.runatlantis.io/docs/terraform-versions.html#via-terraform-config |
I have a project that I just upgraded to terraform 0.13, and that on it's own worked fine. I then attempted to use the new syntax for specifying a provider version, and that seems to cause atlantis to be unable to parse the
required_version
specified in the terraform. For example, with this configuration plans are successful:But with this configuration:
The plan fails with
It seems specifying the provider info breaks
required_version = "0.13.0"
.The text was updated successfully, but these errors were encountered: