→ Back to Home
Infrastructure as Code

Terraform 1.15 Released with Dynamic Module Sources and Deprecation Mechanism

HashiCorp has announced the release of Terraform 1.15, bringing several key enhancements designed to improve the flexibility and maintainability of infrastructure as code. A standout feature in this update is the introduction of dynamic module sources. Previously, module source and version attributes were restricted to string literals, often forcing developers to duplicate module blocks when managing different environments or version pins. With Terraform 1.15, users can now leverage variables within these attributes, allowing for more dynamic and reusable module configurations. A new `const` attribute for variable blocks ensures that these variables can be resolved during the `terraform init` phase, prior to the full configuration evaluation. This functionality extends to nested modules, provided their input variables are also declared with `const = true`. Another significant addition is a formal deprecation mechanism for variables and output blocks. Module authors can now embed deprecation messages directly into their configurations. When a caller uses a deprecated variable or references a deprecated output, Terraform will issue a warning diagnostic during validation. This feature is crucial for managing the lifecycle of modules, allowing authors to guide users through transitions and eventually remove deprecated elements after a grace period. This also extends to provider-defined deprecation messages for resource attributes and blocks, which previously had inconsistent display. Beyond these major language changes, Terraform 1.15 also introduces an inline type conversion function, providing greater control over data types within configurations. Type constraints for output blocks enhance validation and ensure data integrity. Furthermore, the release includes native Windows ARM64 support, broadening the platform's compatibility. It's worth noting that some of the headline features in Terraform 1.15, such as dynamic module sources, have been available in the OpenTofu open-source fork for nearly two years. OpenTofu 1.8.0, released in August 2024, included similar functionality, referred to as early variable and locals evaluation. This allowed variables and locals to be used in module sources, backend configuration, and state encryption settings, addressing a highly requested community feature. The parallel development highlights the ongoing evolution and competition within the Infrastructure as Code ecosystem, with Terraform actively incorporating features that have proven valuable in community-driven alternatives.
#terraform#infrastructure as code#hashicorp#devops#opentofu#cloud automation
Read original source