terraform

Announcing HashiCorp Terraform 0.13 General Availability

We’re excited to announce the release of HashiCorp Terraform 0.13. After much anticipation, Terraform 0.13 is now in general availability. It is immediately available for download as well as for use in Terraform Cloud.

The 0.13 release of Terraform builds on the powerful language improvements made with 0.12, with a focus on improved usability for module-specific workflows and enhancements to our vibrant and growing provider ecosystem. Terraform 0.13 is also the first major release featuring terraform login, which makes it simple to collaborate using Terraform Cloud.

» Terraform 0.13 Highlights

» Improvements to modules

Module-centric workflows are getting a boost with the count, depends_on and for_each features of the Terraform configuration language.

variable "project_id" {
  type = string
}

variable "regions" {
  type = map(object({
    region            = string
    network           = string
    subnetwork        = string
    ip_range_pods     = string
    ip_range_services = string
  }))
}

module "kubernetes_cluster" {
  source   = "terraform-google-modules/kubernetes-engine/google"
  for_each = var.regions

  project_id        = var.project_id
  name              = each.key
  region            = each.value.region
  network           = each.value.network
  subnetwork        = each.value.subnetwork
  ip_range_pods     = each.value.ip_range_pods
  ip_range_services = each.value.ip_range_services
}

Check out the recent blog post on these new module features! We've also updated our HashiCorp Learn collections for Terraform 0.13.

» Automatic Installation of Third-Party Providers

Terraform 0.13 also brings with it a new required providers block. The required providers syntax includes Terraform’s provider source syntax now supports a source address including hostname support for multiple registries and namespaced providers.

terraform {
    required_providers {
        # HashiCorp's dns provider
        hdns = {
            source = "hashicorp/dns"
        }
        # A hypothetical alternative dns provider
        mydns = {
            source = "mycorp/dns"
        }
    }
}

The changes around provider source go hand in hand with improvements to the HashiCorp Terraform Provider Registry. With Terraform 0.13, terraform init will automatically download and install partner, and community providers in the HashiCorp Terraform Registry, following the same clear workflow as HashiCorp-supported official providers. These improvements to the ecosystem will benefit Terraform users and provider developers alike.

For those using official HashiCorp providers such as GCP, AWS & Azure, your configurations will continue to work as is.

» Custom Variable Validation

Custom variable validation, introduced as a language experiment in Terraform 0.12.20, is now a production-ready feature in Terraform 0.13.

variable "ami_id" {
  type = string

  validation {
    condition     = can(regex("^ami-", var.example))
    error_message = "Must be an AMI id, starting with \"ami-\"."
  }
}

» Terraform Cloud

Terraform 0.13 also includes improvements to the enhanced remote backend, allowing users of Terraform Cloud to take advantage of resource targeting (-target) & terraform state push. We’ve also backported these changes to Terraform 0.12 to help ease the transition.

» Getting Started

We have many resources available for 0.13 for new and existing users. To learn more about the new functionality of 0.13 you can:

To get started using 0.13:

  • Download the Terraform 0.13 release.
  • If you are upgrading from a previous release, read the upgrade guide to learn about the required upgrade steps.

For more details, please see the full changelog. This release also includes a number of code contributions from the community and wouldn't have been possible without all of the great community feedback we've received via GitHub issues and elsewhere. Thank you!

HashiCorp Terraform 0.13 is the next step on our way to solidifying the Terraform ecosystem and empowering collaborative workflows at organizations of all sizes. You can download Terraform 0.13 here and sign up for a Terraform Cloud account here.


Sign up for the latest HashiCorp news