diff --git a/tfexec/import_test.go b/tfexec/import_test.go index 460acb2e..f0984008 100644 --- a/tfexec/import_test.go +++ b/tfexec/import_test.go @@ -44,7 +44,7 @@ func TestImport(t *testing.T) { t.Fatal(err) } - state, err := tf.StateShow(ctx) + state, err := tf.Show(ctx) if err != nil { t.Fatal(err) } diff --git a/tfexec/show.go b/tfexec/show.go index 017cbaa3..56fa8564 100644 --- a/tfexec/show.go +++ b/tfexec/show.go @@ -10,13 +10,13 @@ import ( tfjson "github.com/hashicorp/terraform-json" ) -func (tf *Terraform) StateShow(ctx context.Context) (*tfjson.State, error) { +func (tf *Terraform) Show(ctx context.Context) (*tfjson.State, error) { var ret tfjson.State var errBuf strings.Builder var outBuf bytes.Buffer - showCmd := tf.stateShowCmd(ctx) + showCmd := tf.showCmd(ctx) showCmd.Stderr = &errBuf showCmd.Stdout = &outBuf @@ -39,7 +39,7 @@ func (tf *Terraform) StateShow(ctx context.Context) (*tfjson.State, error) { return &ret, nil } -func (tf *Terraform) stateShowCmd(ctx context.Context, args ...string) *exec.Cmd { +func (tf *Terraform) showCmd(ctx context.Context, args ...string) *exec.Cmd { allArgs := []string{"show", "-json", "-no-color"} allArgs = append(allArgs, args...) diff --git a/tfexec/show_test.go b/tfexec/show_test.go index 0137b5c4..6fc65e4a 100644 --- a/tfexec/show_test.go +++ b/tfexec/show_test.go @@ -12,7 +12,7 @@ import ( tfjson "github.com/hashicorp/terraform-json" ) -func TestStateShow(t *testing.T) { +func TestShow(t *testing.T) { td := testTempDir(t) defer os.RemoveAll(td) @@ -52,7 +52,7 @@ func TestStateShow(t *testing.T) { t.Fatalf("error running Init in test directory: %s", err) } - actual, err := tf.StateShow(context.Background()) + actual, err := tf.Show(context.Background()) if err != nil { t.Fatal(err) } @@ -73,7 +73,7 @@ func TestShow_errInitRequired(t *testing.T) { err = copyFile(filepath.Join(testFixtureDir, "basic", testTerraformStateFileName), td) - _, err = tf.StateShow(context.Background()) + _, err = tf.Show(context.Background()) if err == nil { t.Fatal("expected Show to error, but it did not") } else { @@ -84,7 +84,7 @@ func TestShow_errInitRequired(t *testing.T) { } -func TestStateShowCmd(t *testing.T) { +func TestShowCmd(t *testing.T) { td := testTempDir(t) defer os.RemoveAll(td) @@ -94,7 +94,7 @@ func TestStateShowCmd(t *testing.T) { } // defaults - showCmd := tf.stateShowCmd(context.Background()) + showCmd := tf.showCmd(context.Background()) actual := strings.TrimPrefix(cmdString(showCmd), showCmd.Path+" ")