HashiCorp Terraform 0.5

HashiCorp Terraform 0.5

May 08 2015 Mitchell Hashimoto

We've released Terraform 0.5. Terraform is a tool for safely and efficiently building, combining, and launching infrastructure.

Terraform is currently HashiCorp's fastest growing project, and we decided to focus on a strong 0.5 release following last month's major release. Terraform 0.5 adds some huge features, improves the core significantly, and adds significantly more support for AWS resources.

Feature highlights for Terraform 0.5:

Community

» West coast region

provider "aws" { alias = "west"

region = "us-west-2"

}

» Instance using the west coast region

resource "aws_instance" "foo" { provider = "aws.west"

# ...

}

You can now configure a provider multiple times, assign an "alias" to each one, and reference this with the "provider" meta-field on all resources. If any of these are omitted, it will be named "default".

This feature was done by community member Matt Good.

Multi-Provider is fully documented here.

AWS Improvements

Two months ago, HashiCorp hired Clint Shryock to work on AWS improvements full time. For Terraform 0.4, Clint migrated us to the official AWS SDK. For Terraform 0.5, this migration paid off in spades.

Terraform 0.5 had hundreds of contributions, many of them improving the AWS provider. In addition to the contributors, the upstream official AWS SDK was improved to handle automatic API retries for AWS with an exponential backoff. The result of all this improvement is incredible AWS support in Terraform 0.5.

Terraform 0.5 adds support for over 20 new AWS resources and dozens more additional features on top of existing resources. For the full list of new resources, see the CHANGELOG.

vars {
    consul_address = "${aws_instance.consul.private_ip}"
}

}

» Create a web server

resource "aws_instance" "web" {

# ...

user_data = "${template_file.init.rendered}"

}

The template_file resource is used to render files with arbitrary variables that can be populated from other resources using standard interpolation. The result of the rendering is then available to other downstream resources.

Templating is fully documented here.

WinRM

connection {
    type = "winrm"
    user = "Administrator"
    password = "${var.admin_password}"
}

}

You now use the new parameter type on the connection block to specify the type of connection to use. This defaults to SSH so all previous configurations continue to be valid.

WinRM is fully documented here.

Setting Variables via the Environment

Terraform has supported parameterization with variables since version 0.1. With Terraform 0.5, these variables can be set using environment variables in addition to files and command-line flags.

This significantly improves scripting Terraform as well as keeping some secrets out of files and in the environment instead.

$ TF_VAR_image=foo terraform apply ...

Environment variables to set variables is fully documented here.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×