A module maintainer adds a new input variable, log_retention_days, with no default value and publishes the change as minor version 2.3.0. Every caller that runs terraform init -upgrade then fails to plan. How should the maintainer have released the new input?
Select an answer to reveal the explanation.
Short Explanation
A variable with no default is a required field on the form, and you just added it to every caller's form overnight. Give it a default that keeps today's behavior and nobody notices until they choose to use it.
Full Explanation
A variable block without a default argument is a required input, so every module call must set it. Adding one in a release breaks every existing caller, who now receives a missing required argument error during planning, and therefore is a breaking change that would require a major version. The backward-compatible way to add an input is to give it a default that reproduces the module's previous behavior, which makes the input optional; callers that want a different value opt in, and nothing changes for everyone else, so the release correctly remains a minor version. The nullable argument controls whether the variable may be set to null and whether a null value falls back to the default; it does not make a variable without a default optional. Claiming that adding inputs is always compatible ignores that a required input imposes a new obligation on every caller. A validation block checks values that callers supply; it cannot create a value where none was given, so a missing required argument remains an error. Exam caveat: if no safe default exists, ship the input as part of a major version with upgrade notes. Operational check: add a test that calls the module with only the inputs required in the previous version and confirm it plans successfully.