diff --git a/tfexec/terraform.go b/tfexec/terraform.go index 97d745ad..405203cd 100644 --- a/tfexec/terraform.go +++ b/tfexec/terraform.go @@ -523,7 +523,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 @@ -539,12 +539,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) { @@ -592,7 +592,7 @@ func (tf *Terraform) ProvidersSchema(ctx context.Context) (*tfjson.ProviderSchem return nil, parseError(errBuf.String()) } - err = json.Unmarshal(outBuf.Bytes(), ret) + err = json.Unmarshal(outBuf.Bytes(), &ret) if err != nil { return nil, err } diff --git a/tfexec/terraform_test.go b/tfexec/terraform_test.go index dfe44197..c94c37b9 100644 --- a/tfexec/terraform_test.go +++ b/tfexec/terraform_test.go @@ -312,7 +312,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",