version

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

The version package provides a location to set the release versions for all packages to consume, without creating import cycles.

This package should not import any other terraform packages.

Index

Constants

View Source
const Header = "Terraform-Version"

Header is the header name used to send the current terraform version in http requests.

View Source
const VersionToImpersonateForProviders = "1.13.0"

This ONLY represents what features OpenTofu currently intends to support from providers which may change their behavior given a particular TerraformVersion. It explicitly does NOT represent any sort of compatibility promise or guarantee. This value should ONLY ever be used by the provider.ConfigureProvider call, any other usage is WRONG and a PROGRAMMING ERROR. This value should be carefully updated as we add OpenTofu support for new protocol features.

Variables

View Source
var Fork string

Fork is the choudoufu release version (the release tag, e.g. "v0.2.0"). Like dev above, it is expected to be set using linker flags when building release binaries. It stays empty for development builds, which report only the upstream base version.

View Source
var Prerelease string

A pre-release marker for the version, populated using a combination of the raw version and the dev flag.

SemVer is an instance of version.Version representing the main version without any prerelease information.

View Source
var Version string

The main version number that is being run at the moment, populated from the raw version.

Functions

func InterestingDependencies

func InterestingDependencies() []*debug.Module

InterestingDependencies returns the compiled-in module version info for a small number of dependencies that OpenTofu uses broadly and which we tend to upgrade relatively often as part of improvements to OpenTofu.

The set of dependencies this reports might change over time if our opinions change about what's "interesting". This is here only to create a small number of extra annotations in a debug log to help us more easily cross-reference bug reports with dependency changelogs.

func IsDev added in v0.21.0

func IsDev() bool

func IsNightly added in v0.21.0

func IsNightly() bool

func IsOfficialBuild added in v0.21.0

func IsOfficialBuild() bool

IsOfficialBuild returns true if the current executable was built with an argument like the following, which is set by the OpenTofu project's main release process:

-X 'github.com/intentius/choudoufu/version.officialBuild=1'

We use this ONLY to generate warnings where we're intending to stop producing official builds for a certain configuration in a future release series and so want to warn about it. We generate such warnings only when this is set because we want third-parties to be able to create and support their own builds for platforms that are not officially supported, and it would be very annoying if those builds generated irrelevant warnings about what is supported in the official set of release packages.

func String

func String() string

String returns the complete version string, including prerelease

func WithFakedOfficialBuild added in v0.21.0

func WithFakedOfficialBuild(official bool, f func())

WithFakedOfficialBuild runs the given function with the global "official build" flag temporarily forced to the given value, so that IsOfficialBuild will return that value for the duration of that function's runtime.

This is intended for unit testing only. Because it affects global state, it must not be used in parallel tests.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL