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

docs: terraform version usage after allowing additional required_version specifiers #2760

Merged
merged 2 commits into from
Dec 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions runatlantis.io/docs/terraform-versions.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform Versions

You can customize which version of Terraform Atlantis defaults to by setting
the `--default-tf-version` flag (ex. `--default-tf-version=v0.12.0`).
the `--default-tf-version` flag (ex. `--default-tf-version=v1.3.6`).

## Via `atlantis.yaml`
If you wish to use a different version than the default for a specific repo or project, you need
Expand All @@ -10,21 +10,41 @@ to create an `atlantis.yaml` file and set the `terraform_version` key:
version: 3
projects:
- dir: .
terraform_version: v0.10.5
terraform_version: v1.1.5
```
See [atlantis.yaml Use Cases](repo-level-atlantis-yaml.html#terraform-versions) for more details.

## Via terraform config
Alternatively, one can use the terraform configuration block's `required_version` key to specify an *exact* version:
Alternatively, one can use the terraform configuration block's `required_version` key to specify an exact version (`x.y.z` or `= x.y.z`), or as of [atlantis v0.21.0](https://github.com/runatlantis/atlantis/releases/tag/v0.21.0), a comparison or pessimistic [version constraint](https://developer.hashicorp.com/terraform/language/expressions/version-constraints#version-constraint-syntax):
#### Exactly version 1.2.9
```tf
grimm26 marked this conversation as resolved.
Show resolved Hide resolved
terraform {
required_version = "0.12.0"
required_version = "= 1.2.9"
}
```
See [Terraform `required_version`](https://www.terraform.io/language/settings) for reference.
#### Any patch/tiny version of minor version 1.2 (1.2.z)
```tf
terraform {
required_version = "~> 1.2.0"
}
```
#### Any minor version of major version 1 (1.y.z)
```tf
terraform {
required_version = "~> 1.2"
}
```
#### Any version that is at least 1.2.0
```tf
terraform {
required_version = ">= 1.2.0"
}
```
See [Terraform `required_version`](https://developer.hashicorp.com/terraform/language/settings#specifying-a-required-terraform-version) for reference.

::: tip NOTE
Atlantis will automatically download the version specified.
Atlantis will automatically download the latest version that fulfills the constraint specified.
A `terraform_version` specified in the `atlantis.yaml` file takes precedence over both the [`--default-tf-version`](server-configuration.html#default-tf-version) flag and the `required_version` in the terraform hcl.
:::

::: tip NOTE
Expand Down