Phyxx
Phyxx

Reputation: 16085

Terraform JSON "At 1:1: illegal char" error

When attempting to run terraform init with a JSON I keep getting the error:

There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.

Error: Error parsing C:\terraform\terraform.tf.json: At 1:1: illegal char

The JSON is valid and the HCF version works as expected. What is wrong?

Upvotes: 0

Views: 1785

Answers (1)

Phyxx
Phyxx

Reputation: 16085

I'm answering this for myself because it took a little while to work out.

The JSON file was a BOM formatted UTF8 file, and I assume that the illegal char at 1:1 was the BOM itself. Once I saved the content as a plain file with no BOM, terraform worked as expected.

Upvotes: 2

Related Questions