Upgrade Terraform 0.11 to 0.12

HashiCorp Terraform

Run the Terraform 0.12upgrade command

tfenv install 0.12.20
tfenv use 0.12.20
terraform 0.12upgrade
gfind <your top level TF directory> -name '*.tf' -printf "%h\n" \
| uniq \
| grep -v ".terraform" \
| xargs -n1 terraform 0.12upgrade -yes

What if I have to change it by hand?

Using Variables

foo = "${var.bar}"
foo = var.bar

Terraform Remote State

vpc_id = "${data.terraform_remote_state.vpc.vpc_id}"
vpc_id = data.terraform_remote_state.vpc.outputs.vpc_id
config {
region = "${var.aws_region}"
}
config = {
region = var.aws_region
}

AWS Resources

tags {
service = "${var.service}"
environment = "${var.env}"
}
tags = {
service = var.service
environment = var.env
}

Backend software engineer at Stash. Pursuing an MDIV at Reformed Theological Seminary. Princeton 2018 - Electrical Engineering. Opinions are my own.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store