-
Notifications
You must be signed in to change notification settings - Fork 10k
Closed
Description
I don't get an error from plan
when loading a JSON .tf file, but it doesn't find anything to do vs. when loading the corresponding HCL .tf version. The JSON was generated from HCL using the hcl library in this way:
renier@taurus test $ cat test.hcl
provider "softlayer" {}
resource "softlayer_ssh_key" "my_key" {
label = "Renier Key Add Test"
public_key = "${file("~/.ssh/id2_rsa.pub")}"
}
renier@taurus test $ hcl2json test.hcl test.tf
renier@taurus test $ cat test.tf
{
"provider": [
{
"softlayer": [
{}
]
}
],
"resource": [
{
"softlayer_ssh_key": [
{
"my_key": [
{
"label": "Renier Key Add Test",
"public_key": "${file(\"~/.ssh/id2_rsa.pub\")}"
}
]
}
]
}
]
}
renier@taurus test $ ls *.tf
-rw-r--r-- 1 renier staff 480B Oct 11 16:49 test.tf
renier@taurus test $ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but
will not be persisted to local or remote state storage.
No changes. Infrastructure is up-to-date. This means that Terraform
could not detect any differences between your configuration and
the real physical resources that exist. As a result, Terraform
doesn't need to do anything.
renier@taurus test $ cp test.hcl test.tf
renier@taurus test $ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but
will not be persisted to local or remote state storage.
The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed. Cyan entries are data sources to be read.
Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.
+ softlayer_ssh_key.my_key
fingerprint: "<computed>"
label: "Renier Key Add Test"
public_key: "ssh-rsa ********\n"
Plan: 1 to add, 0 to change, 0 to destroy.
If I manually edit the json, to strip out the array brackets, it works. However, shouldn't terraform be able to understand the JSON with the array brackets?