diff --git a/tfexec/terraform.go b/tfexec/terraform.go index 609b98dd..fc40771d 100644 --- a/tfexec/terraform.go +++ b/tfexec/terraform.go @@ -535,7 +535,7 @@ type OutputMeta struct { Value json.RawMessage `json:"value"` } -func (tf *Terraform) Output(ctx context.Context, opts ...OutputOption) (map[string]OutputMeta, error) { +func (tf *Terraform) Output(ctx context.Context, opts ...OutputOption) (*map[string]OutputMeta, error) { outputCmd := tf.OutputCmd(ctx, opts...) var errBuf strings.Builder @@ -551,12 +551,12 @@ func (tf *Terraform) Output(ctx context.Context, opts ...OutputOption) (map[stri return nil, parseError(err.Error()) } - err = json.Unmarshal(outBuf.Bytes(), outputs) + err = json.Unmarshal(outBuf.Bytes(), &outputs) if err != nil { return nil, err } - return outputs, nil + return &outputs, nil } func (tf *Terraform) StateShow(ctx context.Context) (*tfjson.State, error) { diff --git a/tfexec/terraform_test.go b/tfexec/terraform_test.go index fb6c425a..ee1ef59e 100644 --- a/tfexec/terraform_test.go +++ b/tfexec/terraform_test.go @@ -351,7 +351,7 @@ func TestStateShow(t *testing.T) { TerraformVersion: "0.12.24", Values: &tfjson.StateValues{ RootModule: &tfjson.StateModule{ - Resources: []*tfjson.StateResource{&tfjson.StateResource{ + Resources: []*tfjson.StateResource{{ Address: "null_resource.foo", AttributeValues: map[string]interface{}{ "id": "5510719323588825107",