docs/src/data/experiments/version-attribute.mdx
Support for a version attribute on the terraform block that resolves a registry module from a version constraint.
version-attribute - What it doesWhen enabled, the terraform block accepts an optional version attribute holding a version constraint for a tfr:// registry module, such as ~> 3.3 or >= 1.0.0, < 2.0.0:
terraform {
source = "tfr://registry.opentofu.org/terraform-aws-modules/vpc/aws"
version = "~> 3.3"
}
Terragrunt resolves the constraint against the registry's list-versions endpoint before the download begins, then fetches the highest published version that satisfies it. This brings the terraform block to parity with the version argument on OpenTofu and Terraform module blocks, so you no longer have to pin an exact version in the source URL.
The constraint lives only in the version attribute. By the time the module is downloaded and cached, it has been resolved to an exact version, so the --source override and the cache key still carry a concrete pin.
version-attribute - How to enable it# Via CLI flag
terragrunt --experiment version-attribute run -- plan
# Via environment variable
export TG_EXPERIMENT=version-attribute
terragrunt run -- plan
version-attribute - How to provide feedbackTrack and discuss this experiment in gruntwork-io/terragrunt#1930. When reporting issues or providing feedback, please include:
tfr:// source and the version constraint you set.version-attribute - Criteria for stabilizationTo transition the version-attribute feature to a stable release, the following must be addressed, at a minimum:
--source-update. Confirm this is the right default, or re-resolve on every run.>= 1.0.0-rc1) opts into prereleases, matching OpenTofu and Terraform.--source and TG_SOURCE should keep accepting exact pins only, or also accept constraints.