A peek into Terraform v1.5

Jean-Michel Girard
2 min readJul 19, 2023

--

Discover What’s New in Terraform 1.5: Empowering Infrastructure Automation

One of the standout features of Terraform 1.5 is its advanced state management capabilities with the introduction of enhanced state locking. The upgraded state snapshot functionality allows for more efficient tracking of infrastructure changes, making it easier to roll back or audit configurations when needed.

Performance optimization is another key focus of Terraform 1.5. The introduction of incremental state downloads allows for faster operations, reducing the time taken to fetch and update state information.

The Import Blocks

A welcomed addition, the import blocks are exactly what you’d think, Like the moved blocks, the modify the state by importing resources.

  • The suggested file name is imports.tf
  • Resources are imported one at a time.
  • State is immediately modified, with no opportunity to preview the results.

The Check Blocks

Terraform 1.5 introduce a new validation mechanism: the check block. Checks are a new top-level construct which gives module authors additional flexibility to define assertions within Terraform code. While there is overlap between the use cases for postconditions and checks, the check block has several notable differences:

  • Because they exist at the top level, checks can reference all resources, data sources, and module outputs in the configuration. Checks are best suited for overall functional validation of the infrastructure, while postconditions guarantee the configuration of a single resource.
  • Checks occur as the last step in the plan or apply and do not halt execution. Failed checks emit a warning message instead of an error.
  • Checks can contain more than one assertion.
  • Has the ability to reference all objects in the configuration.
  • A check block can optionally include one nested (“scoped”) data source. If a scoped data source fails to execute, the error is contained to the check block evaluation and does not halt overall execution of the Terraform run.

--

--

No responses yet