diff --git a/pkg/iac-providers/terraform/v12/load-file_test.go b/pkg/iac-providers/terraform/v12/load-file_test.go index ab0270f27..d1f289042 100644 --- a/pkg/iac-providers/terraform/v12/load-file_test.go +++ b/pkg/iac-providers/terraform/v12/load-file_test.go @@ -78,6 +78,13 @@ func TestLoadIacFile(t *testing.T) { tfv12: TfV12{}, wantErr: nil, }, + { + name: "config1", + tfConfigFile: "./testdata/dummyconfig/dummyconfig.tf", + tfJSONFile: "./testdata/tfjson/dummyconfig.json", + tfv12: TfV12{}, + wantErr: nil, + }, } for _, tt := range table2 { diff --git a/pkg/iac-providers/terraform/v12/testdata/dummyconfig/dummyconfig.tf b/pkg/iac-providers/terraform/v12/testdata/dummyconfig/dummyconfig.tf new file mode 100644 index 000000000..a2f973393 --- /dev/null +++ b/pkg/iac-providers/terraform/v12/testdata/dummyconfig/dummyconfig.tf @@ -0,0 +1,55 @@ +resource "type1" "resource1" { + test3 = 1 + 2 + test1 = "hello" + test2 = 5 + arr = [1, 2, 3, 4] + hyphen-test = 3 + temp = "${1 + 2} %{if local.test2 < 3}\"4\n\"%{endif}" + temp2 = "${"hi"} there" + quoted = "\"quoted\"" + squoted = "'quoted'" + } + +resource "type2" "resource2"{ + other = { + num = local.test2 + 5 + thing = [for x in local.arr: x * 2] + "${local.test3}" = 4 + 3 = 1 + "local.test1" = 89 + "a.b.c[\"hi\"][3].*" = 3 + loop = "This has a for loop: %{for x in local.arr}x,%{endfor}" + a.b.c = "True" + } +} + +resource "type3" "resource3" { + heredoc = <<-EOF + This is a heredoc template. + It references ${local.other.3} + EOF + simple = 4 - 2 + cond = test3 > 2 ? 1: 0 + heredoc2 = <