runway.env_mgr.tfenv module¶
Terraform version management.
- class runway.env_mgr.tfenv.TFEnvManager[source]¶
Bases:
EnvManager
Terraform version management.
Designed to be compatible with https://github.com/tfutils/tfenv.
- get_min_required() str [source]¶
Get the defined minimum required version of Terraform.
- Returns:
The minimum required version as defined in the module.
- classmethod get_version_from_executable(bin_path: Path | str, *, cwd: Path | str | None = None, env: dict[str, str] | None = None) Version | None [source]¶
Get Terraform version from an executable.
- Parameters:
bin_path – Path to the Terraform binary to retrieve the version from.
cwd – Current working directory to use when calling the executable.
env – Environment variable overrides.
- get_version_from_file(file_path: Path | None = None) str | None [source]¶
Get Terraform version from a file.
- Parameters:
file_path – Path to file that will be read.
- list_installed() Generator[Path, None, None] [source]¶
List installed versions of Terraform.
Only lists versions of Terraform that have been installed by an instance if this class or by tfenv.
- classmethod parse_version_string(version: str) Version [source]¶
Parse version string into a
Version
.- Parameters:
version – Version string to parse. Must be in the format of
<major>.<minor>.<patch>
with an optional-<prerelease>
.
- set_version(version: str) None [source]¶
Set current version.
Clears cached values as needed.
- Parameters:
version – Version string. Must be in the format of
<major>.<minor>.<patch>
with an optional-<prerelease>
.
- runway.env_mgr.tfenv.download_tf_release(version: str, versions_dir: Path, command_suffix: str, tf_platform: str | None = None, arch: str | None = None) None [source]¶
Download Terraform archive and return path to it.
- runway.env_mgr.tfenv.get_available_tf_versions(include_prerelease: bool = False) list[str] [source]¶
Return available Terraform versions.