fix: Avoids issue due to strict requirement for fileexists to return consistent results#722
Conversation
b1c6785 to
03b0dea
Compare
In old versions of terraform, the ternary operator did not short-circuit, and so the `was_missing` logic was a hack to workaround both paths executing on every execution. The module needed the hack to avoid failing When the package existed previously vs when it did not and was being created by the module itself. In recent-ish version of terraform, including the module min version 1.5.7, the ternary operator will shortcircuit, so it will only execute the true OR false logic, rather than both. This makes the `was_missing` logic unnecessary. Further, in most recent versions of terraform, at least since 1.13.0, the `was_missing` logic resulted in a failure when separately building the package and then attempting to use the package in the same workflow. The failure occurred because terraform became more strict at enforcing that the return values of the `fileexists()` function be consistent between plan and apply phases. Fixes terraform-aws-modules#698
03b0dea to
bfcda3f
Compare
|
@antonbabenko Any chance you might have a bit to review this one? I think I tracked down the rationale for the original implementation, which is no longer needed in the terraform min version supported by the module, so this patch is just removing that |
|
I don't see a CODEOWNERS file... are there any other maintainers that can review/merge? |
|
@lorengordon I will review this one and another related one during the weekend. I know I am rather slow with these reviews sometimes. |
## [8.2.1](v8.2.0...v8.2.1) (2026-01-25) ### Bug Fixes * Avoids issue due to strict requirement for fileexists to return consistent results ([#722](#722)) ([d6b4321](d6b4321))
|
This PR is included in version 8.2.1 🎉 |
|
Thank you very much for the detailed research and the fix @lorengordon ! |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
In old versions of terraform, the ternary operator did not short-circuit, and so the
was_missinglogic was needed as a hack to workaround both logic paths executing on every run. The module needed the hack to avoid failing when the package existed previously vs when it did not and was being created by the module itself.In recent-ish versions of terraform, including the module min version 1.5.7, the ternary operator will shortcircuit, so it will only execute the true OR false logic, rather than both. This makes the
was_missinglogic unnecessary.Further, in most recent versions of terraform, at least since 1.13.0, the
was_missinglogic resulted in a failure when separately building the package and then attempting to use the package in the same workflow. The failure occurred because terraform became more strict at enforcing that the return values of thefileexists()function be consistent between plan and apply phases.Fixes #698
Breaking Changes
None
How Has This Been Tested?
examples/*to demonstrate and validate my change(s)examples/*projectspre-commit run -aon my pull request