Skip to content

fix: correct the Terraform version floors for the examples - #77

Merged
bryce-lynn-nttd merged 1 commit into
mainfrom
fix/terraform-version-floor-examples
Aug 4, 2026
Merged

fix: correct the Terraform version floors for the examples#77
bryce-lynn-nttd merged 1 commit into
mainfrom
fix/terraform-version-floor-examples

Conversation

@bryce-lynn-nttd

Copy link
Copy Markdown
Contributor

Summary

Corrects required_version where the declared Terraform floor does not match what the code actually requires.

| examples/already_zipped | ~> 1.0 | ~> 1.5 |
| examples/from_folder | ~> 1.0 | ~> 1.5 |
| examples/pip_install_pyproject | ~> 1.0 | ~> 1.5 |
| examples/pip_install_requirements | ~> 1.0 | ~> 1.5 |

Why this is wrong today

A consumer on a version inside the declared range satisfies the constraint and then hits a hard parse error, so the constraint misleads instead of protecting. make lint cannot catch it, because it validates with the .tool-versions Terraform rather than the declared floor, and CI runs a recent version that satisfies every floor.

Where an example needs more than the root, the requirement usually comes from a module it consumes — most examples use resource_name, which declares ~> 1.5. That is invisible in this repository's own HCL and only appears when the example is initialized.

The rule being applied

An example must declare at least the root's floor, and may declare more. Terraform enforces every required_version in the module tree and takes the maximum, so an example declaring less is stating something untrue about itself — but the root should not be dragged up to cover what an example imports, since consumers use the root module. Enforced by launch-terraform-skeleton#40.

Verification

Each directory was loaded with terraform init -backend=false && validate using the oldest version its constraint permits, before and after. The full fleet survey covered all 95 converted repos; 31 needed a correction.

READMEs are updated because terraform-docs renders required_version into the Requirements table and the pre-commit hook fails on a stale one.

Impact

Not a practical breaking change: nobody below the corrected floor could have been using this successfully, so no working consumer loses anything. Ceilings are unchanged.

Generated with Cursor Agent (Opus 5)

The root module and its examples do not need the same Terraform version.
Verified by loading each directory with the oldest binary its own constraint
permits, so the values come from Terraform rather than from reading the HCL.
@bryce-lynn-nttd
bryce-lynn-nttd requested a review from a team as a code owner August 4, 2026 18:07
@github-actions github-actions Bot added the fix label Aug 4, 2026

@ben-vaughan-nttd ben-vaughan-nttd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version-floor review: root required_version matches root HCL; root README Requirements stay in sync with versions.tf. Example floor changes are scoped to examples/complete and are not a manual review gate. CI is green.

@rakesh-gorige-nttd rakesh-gorige-nttd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — example required_version aligned to transitive module constraints. Root floor unchanged and still accurate for this module HCL.

@bryce-lynn-nttd
bryce-lynn-nttd merged commit 80bd301 into main Aug 4, 2026
18 checks passed
@bryce-lynn-nttd
bryce-lynn-nttd deleted the fix/terraform-version-floor-examples branch August 4, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants