Lack of default connection settings in Terraform 0.12.x

August 29, 2019 – Samuli Seppänen

I was recently bit by a feature (one might call it a bug) in Terraform. We wanted to try out the "Networks" feature in Hetzner Cloud but that required upgrading terraform-provider-hcloud, which in turn required upgrading Terraform to 0.12.x. For the most part migration from 0.11.x code to 0.12.x code was straightforward with some help from the automated migration tool. I even went as far as read some of the migration documentation, but missed one important part: connection blocks no longer have default values. To make the matter worse Terraform 0.12 does not error out if values are unset: instead if just runs the provisioner and then times out. This seems to be related to Terraform bug #21690.

The problem is clearly visible if you run Terraform in debug mode, i.e. do

$ TF_LOG=debug terraform apply

You'll see that the SSH connection strings have something like "root@:22" in them - meaning the actual server to connect to is missing.

Want to talk to an expert?

If you want to reach us, just send us a message or book a free call!
menucross-circle