Dynamic Terraform/OpenTofu Version Detection

Support dynamic detection and usage of Terraform/OpenTofu versions based on version definitions already present in codebases. This avoids duplicating version definitions in Spacelift configuration and aligns with local developer workflows.

Core Feature Scope

  1. Auto-detect versions from common versioning files
    Auto-detect the version from:

    • .terraform-version

    • .tool-versions (used by asdf)

    • .tfswitchrc

    • required_version in .tf files (with logic to use the lowest matching version)

  2. Auto-detection should happen in both:

    • Root directory

    • Module directories

  3. Fallback behavior:
    Ability to define a default/fallback version at the org or stack level (optional but configurable).


We’re using Renovate to auto-bump Terraform versions within their .tf files directly. WE do not want to manage a separate .terraform-version or .tofu-version file or make manual updates in Spacelift stacks. We want to maintain:

hcl

CopyEdit

required_version = ">=x.y.z"

And have Spacelift:

  • Automatically use the lowest compatible version from that constraint

  • Avoid hardcoding the version in the stack config or using custom Docker images

Workaround
Manual parsing of version files in custom workflows Hardcoding version numbers in stacks or Docker images Using custom logic to switch binaries
Problem
-

Please authenticate to join the conversation.

Upvoters
Status

πŸ”­ Discovery

Board

πŸ’‘ Feature Requests

Date

7 months ago

Subscribe to post

Get notified by email when there are changes.