Infrastructure
OpenTofu 1.13 Gives Module Developers Tools to Resolve Unknowns Earlier
New type-hinting functions let infrastructure code determine resource counts at plan time even when input values remain uncertain.
InfoQ
OpenTofu's latest release introduces capabilities designed to help module authors work through uncertainty when planning infrastructure changes. Version 1.13 includes functions that allow planners to make decisions about resource allocation without needing the complete picture of every attribute that will eventually be applied.
The Problem: Unknown Values Block Planning#
In practice, infrastructure code sometimes depends on values that won't be fully known until execution. A common scenario arises when module authors decode YAML input: the structure might be an object, could be null, or might fail to parse completely. Since yamldecode produces values of indeterminate type from unknown input, infrastructure-as-code tools can't determine whether count or for_each loops should even run. The planner gets stuck.
As OpenTofu maintainer Martin Atkins noted in the RFC, inferring the right behavior automatically would require solving an overly complex problem. The real-world case surfaced when a user wanted to retain YAML input while keeping the ability to plan their configuration.
New Functions Unblock Planning#
Two new functions, convert and assumenotnull, give module authors a way out. The convert function accepts a value and a target type, forcing unknown YAML results into a known object shape. By combining that conversion with assumenotnull, developers can write conditional logic—like a count expression—that resolves to zero or one while the object's internal contents stay unknown until apply time.
The catch: module authors must guarantee their generated YAML always produces the declared type and never null. If the input violates that promise during apply, OpenTofu surfaces an error then.
OpenTofu's design mirrors an earlier Terraform addition: Terraform shipped its own convert function in version 1.15, and OpenTofu opted to match the same interface for consistency.
Experimental Features Round Out the Release#
Version 1.13 also debuts experimental linting, running four built-in rule checks such as and . Users can activate these warnings using the flag during validate, plan, or apply operations. Linting was the project's most-requested feature; the maintainers plan to add custom rules and broader policy controls in future releases.

