Skip to content

Commit ccc0489

Browse files
committed
fix plancheck import
1 parent 4257d69 commit ccc0489

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

mmv1/templates/terraform/samples/base_configs/test_file.go.tmpl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717

1818
package {{ $.Res.PackageName }}_test
1919

20+
{{ $needsPlancheck := false }}
21+
{{ range $s := $.Res.TestSamples }}
22+
{{ if gt (len $s.TestSteps) 1 }}
23+
{{ $needsPlancheck = true }}
24+
{{ end }}
25+
{{ end }}
26+
2027
import (
2128
"fmt"
2229
"log"
@@ -26,8 +33,8 @@ import (
2633
"time"
2734

2835
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
29-
"github.com/hashicorp/terraform-plugin-testing/plancheck"
30-
"github.com/hashicorp/terraform-plugin-testing/terraform"
36+
{{ if $needsPlancheck }} "github.com/hashicorp/terraform-plugin-testing/plancheck"
37+
{{ end }} "github.com/hashicorp/terraform-plugin-testing/terraform"
3138

3239
"{{ $.ImportPath }}/acctest"
3340
"{{ $.ImportPath }}/envvar"

0 commit comments

Comments
 (0)