Add OpenTofu version file support (#59)
Some checks failed
Continuous Integration / Check dist/ directory (push) Has been cancelled
Continuous Integration / Test (push) Has been cancelled
Setup OpenTofu / OpenTofu Version Files (push) Has been cancelled
Setup OpenTofu / OpenTofu Versions (push) Has been cancelled
Setup OpenTofu / OpenTofu Arguments (push) Has been cancelled
Setup OpenTofu / OpenTofu Run Local (push) Has been cancelled
Setup OpenTofu / OpenTofu Cloud Credentials (push) Has been cancelled
Setup OpenTofu / OpenTofu Enterprise Credentials (push) Has been cancelled
Setup OpenTofu / OpenTofu No Credentials (push) Has been cancelled

Signed-off-by: Brendon Smith <bws@bws.bio>
This commit is contained in:
Brendon Smith 2025-08-04 08:32:54 -04:00 committed by GitHub
parent 4a98c1282d
commit 000eeb8522
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 258 additions and 2 deletions

View file

@ -28,6 +28,17 @@ steps:
tofu_version: 1.6.0
```
You can also specify the version in a file (e.g., `.opentofu-version`):
```yaml
steps:
- uses: opentofu/setup-opentofu@v1
with:
tofu_version_file: .opentofu-version
```
Supported version syntax is the same as for the `tofu_version` input. If both `tofu_version` and `tofu_version_file` are provided, the version number in the file takes precedence.
Credentials for Terraform Cloud ([app.terraform.io](https://app.terraform.io/)) can be configured:
```yaml
@ -248,6 +259,8 @@ The action supports the following inputs:
for available range specifications). Examples are: `<1.6.0-beta`, `~1.6.0-alpha`, `1.6.0-alpha2` (all three installing
the latest available `1.6.0-alpha2` version). Prerelease versions can be specified and a range will stay within the
given tag such as `beta` or `rc`. If no version is given, it will default to `latest`.
- `tofu_version_file` - (optional) Path to a file containing the OpenTofu version to install. Supported version syntax
is the same as for the `tofu_version` input. Takes precedence over `tofu_version` if both are provided.
- `tofu_wrapper` - (optional) Whether to install a wrapper to wrap subsequent calls of
the `tofu` binary and expose its STDOUT, STDERR, and exit code as outputs
named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`.