config: test that JSON loading terraform backend info works

This commit is contained in:
Mitchell Hashimoto 2017-03-16 14:51:26 -07:00
parent 25312c8985
commit f7da5d323c
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 34 additions and 0 deletions

View File

@ -359,6 +359,31 @@ backend (s3)
}
}
func TestLoadFile_terraformBackendJSON(t *testing.T) {
c, err := LoadFile(filepath.Join(fixtureDir, "terraform-backend.tf.json"))
if err != nil {
t.Fatalf("err: %s", err)
}
if c == nil {
t.Fatal("config should not be nil")
}
if c.Dir != "" {
t.Fatalf("bad: %#v", c.Dir)
}
{
actual := terraformStr(c.Terraform)
expected := strings.TrimSpace(`
backend (s3)
foo`)
if actual != expected {
t.Fatalf("bad:\n%s", actual)
}
}
}
func TestLoadFile_terraformBackendMulti(t *testing.T) {
_, err := LoadFile(filepath.Join(fixtureDir, "terraform-backend-multi.tf"))
if err == nil {

View File

@ -0,0 +1,9 @@
{
"terraform": [{
"backend": [{
"s3": {
"foo": "bar"
}
}]
}]
}