Terraform 1.15 Shifts Infrastructure Automation with Dynamic Sources and Variable Deprecation

Terraform 1.15 Delivers Major Flexibility and Migration Improvements

HashiCorp has released Terraform 1.15, a significant update that introduces dynamic module sources and formal variable and output deprecation. The new features give practitioners more control over module configurations while reducing the risk of breaking changes in production environments.

Terraform 1.15 Shifts Infrastructure Automation with Dynamic Sources and Variable Deprecation

“This release addresses core workflows where practitioners need to parameterize module sources without manual workarounds,” said James Bardin, Senior Software Engineer at HashiCorp. “The const attribute ensures that variables used during terraform init are safely resolved and prevented from being misused.”

Dynamic Module Sources

With Terraform 1.15, module sources can now include variables. Previously, sources were limited to static strings, forcing users to copy or hardcode paths. The update introduces a new const attribute for variables, which must be set to true to allow use during init.

“The const attribute is mutually exclusive with sensitive and ephemeral,” Bardin explained. “It signals that the variable holds a compile-time constant, enabling safe interpolation in module sources.”

variable "folder" {
  type  = string
  const = true
}

module "zoo" {
  source = "./${var.folder}"
}

This dynamic sourcing extends to nested modules, provided all input variables along the dependency chain are declared with const = true. Terraform will produce an error during init if any non-constant variable or local is referenced.

Variable and Output Deprecation

To help module authors phase out old inputs and outputs gracefully, Terraform 1.15 adds a deprecated attribute for both variable and output blocks. When a deprecated variable is used or a deprecated output is referenced, Terraform issues a warning diagnostic during validation.

# mod/main.tf
variable "bad" {
  deprecated = "Please use 'good' instead, this variable will be removed"
}

output "old" {
  value = ...
  deprecated = "Please use 'new' instead, this output will be removed"
}

Warnings propagate to root-level variables and module calls. For example, passing a value to a deprecated variable via CLI arguments or environment variables triggers a diagnostic. Similarly, referencing a deprecated output in any local or resource produces a warning.

“Deprecation can be cascaded,” Bardin noted. “A deprecated output can safely consume values from another deprecated output without generating multiple warnings. This allows module authors to manage internal deprecation chains cleanly.”

Background

Prior to 1.15, dynamically sourcing modules required cumbersome workarounds like using terraform_data or manual symlinks. Static source declarations made it difficult to reuse modules across environments with different local paths. Variable and output deprecation had no formal mechanism—authors relied on documentation and manual versioning to warn users.

The constinit are fully resolved before any plan or apply occurs.

What This Means

Practitioners can now build more flexible Terraform configurations without sacrificing safety. Dynamic module sources enable multi-environment deployments with a single source tree, reducing duplication and drift. At the same time, explicit deprecation attributes give operators clear migration paths and automated warnings, minimizing surprise breakages.

“The combination of these two features marks a shift toward more maintainable infrastructure code,” said Bardin. “We expect teams to adopt them quickly, improving both developer experience and operational reliability.”

Terrafom 1.15 is available immediately via the HashiCorp website and package managers. Users are encouraged to update and test the new features in non-production environments first.

Tags:

Recommended

Discover More

10 Key Strategies for Maximizing Token Efficiency in GitHub Agentic WorkflowsInstructure Data Breach Report: Lessons in Journalistic VerificationA Step-by-Step Guide to Understanding and Supporting the Ban on Player Underperformance BetsSaros Final Boss Strategy Revealed: Mastering Defensive Skills Key to VictoryMastering Systematic Prompting: A Developer's Q&A on Key Techniques