github.com/wikibal01/hashicorp-terraform@v0.11.12-beta1/terraform/testing.go (about) 1 package terraform 2 3 import ( 4 "os" 5 "testing" 6 ) 7 8 // TestStateFile writes the given state to the path. 9 func TestStateFile(t *testing.T, path string, state *State) { 10 f, err := os.Create(path) 11 if err != nil { 12 t.Fatalf("err: %s", err) 13 } 14 defer f.Close() 15 16 if err := WriteState(state, f); err != nil { 17 t.Fatalf("err: %s", err) 18 } 19 }