hashicorp / terraform-plugin-framework

A next-generation framework for building Terraform providers.
https://developer.hashicorp.com/terraform/plugin/framework
Mozilla Public License 2.0
305 stars 93 forks source link

Can't run go tests #963

Closed brownwk closed 8 months ago

brownwk commented 8 months ago

Module version

module terraform-provider-hashicups-pf

go 1.21

toolchain go1.21.3

require (
    github.com/hashicorp-demoapp/hashicups-client-go v0.1.0
    github.com/hashicorp/terraform-plugin-docs v0.18.0
    github.com/hashicorp/terraform-plugin-framework v1.5.0
    github.com/hashicorp/terraform-plugin-go v0.22.0
    github.com/hashicorp/terraform-plugin-log v0.9.0
    github.com/hashicorp/terraform-plugin-testing v1.7.0
)

require (
    github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
    github.com/Masterminds/goutils v1.1.1 // indirect
    github.com/Masterminds/semver/v3 v3.2.0 // indirect
    github.com/Masterminds/sprig/v3 v3.2.3 // indirect
    github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect
    github.com/agext/levenshtein v1.2.2 // indirect
    github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
    github.com/armon/go-radix v1.0.0 // indirect
    github.com/bgentry/speakeasy v0.1.0 // indirect
    github.com/cloudflare/circl v1.3.7 // indirect
    github.com/fatih/color v1.16.0 // indirect
    github.com/golang/protobuf v1.5.3 // indirect
    github.com/google/go-cmp v0.6.0 // indirect
    github.com/google/uuid v1.4.0 // indirect
    github.com/hashicorp/cli v1.1.6 // indirect
    github.com/hashicorp/errwrap v1.1.0 // indirect
    github.com/hashicorp/go-checkpoint v0.5.0 // indirect
    github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
    github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
    github.com/hashicorp/go-hclog v1.6.2 // indirect
    github.com/hashicorp/go-multierror v1.1.1 // indirect
    github.com/hashicorp/go-plugin v1.6.0 // indirect
    github.com/hashicorp/go-uuid v1.0.3 // indirect
    github.com/hashicorp/go-version v1.6.0 // indirect
    github.com/hashicorp/hc-install v0.6.3 // indirect
    github.com/hashicorp/hcl/v2 v2.20.0 // indirect
    github.com/hashicorp/logutils v1.0.0 // indirect
    github.com/hashicorp/terraform-exec v0.20.0 // indirect
    github.com/hashicorp/terraform-json v0.21.0 // indirect
    github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 // indirect
    github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
    github.com/hashicorp/terraform-svchost v0.1.1 // indirect
    github.com/hashicorp/yamux v0.1.1 // indirect
    github.com/huandu/xstrings v1.3.3 // indirect
    github.com/imdario/mergo v0.3.15 // indirect
    github.com/mattn/go-colorable v0.1.13 // indirect
    github.com/mattn/go-isatty v0.0.20 // indirect
    github.com/mattn/go-runewidth v0.0.9 // indirect
    github.com/mitchellh/copystructure v1.2.0 // indirect
    github.com/mitchellh/go-testing-interface v1.14.1 // indirect
    github.com/mitchellh/go-wordwrap v1.0.0 // indirect
    github.com/mitchellh/mapstructure v1.5.0 // indirect
    github.com/mitchellh/reflectwalk v1.0.2 // indirect
    github.com/oklog/run v1.0.0 // indirect
    github.com/posener/complete v1.2.3 // indirect
    github.com/russross/blackfriday v1.6.0 // indirect
    github.com/shopspring/decimal v1.3.1 // indirect
    github.com/spf13/cast v1.5.0 // indirect
    github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
    github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
    github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
    github.com/yuin/goldmark v1.6.0 // indirect
    github.com/yuin/goldmark-meta v1.1.0 // indirect
    github.com/zclconf/go-cty v1.14.3 // indirect
    golang.org/x/crypto v0.21.0 // indirect
    golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
    golang.org/x/mod v0.15.0 // indirect
    golang.org/x/net v0.21.0 // indirect
    golang.org/x/sys v0.18.0 // indirect
    golang.org/x/text v0.14.0 // indirect
    golang.org/x/tools v0.13.0 // indirect
    google.golang.org/appengine v1.6.8 // indirect
    google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
    google.golang.org/grpc v1.61.1 // indirect
    google.golang.org/protobuf v1.32.0 // indirect
    gopkg.in/yaml.v2 v2.3.0 // indirect
)

Relevant provider source code

...

Terraform Configuration Files

...

Debug Output

Expected Behavior

go should be able to perform a test of the data provider

Actual Behavior

TF_ACC=1 go test -count=1 -v

github.com/hashicorp/terraform-plugin-framework/internal/toproto6

../../../go/pkg/mod/github.com/hashicorp/terraform-plugin-framework@v1.5.0/internal/toproto6/callfunction.go:21:3: unknown field Diagnostics in struct literal of type tfprotov6.CallFunctionResponse ../../../go/pkg/mod/github.com/hashicorp/terraform-plugin-framework@v1.5.0/internal/toproto6/callfunction.go:26:35: proto.Diagnostics undefined (type tfprotov6.CallFunctionResponse has no field or method Diagnostics) ../../../go/pkg/mod/github.com/hashicorp/terraform-plugin-framework@v1.5.0/internal/toproto6/diagnostics.go:39:24: tfprotov6Diagnostic.FunctionArgument undefined (type tfprotov6.Diagnostic has no field or method FunctionArgument)

github.com/hashicorp/terraform-plugin-framework/internal/toproto5

../../../go/pkg/mod/github.com/hashicorp/terraform-plugin-framework@v1.5.0/internal/toproto5/callfunction.go:21:3: unknown field Diagnostics in struct literal of type tfprotov5.CallFunctionResponse ../../../go/pkg/mod/github.com/hashicorp/terraform-plugin-framework@v1.5.0/internal/toproto5/callfunction.go:26:35: proto.Diagnostics undefined (type tfprotov5.CallFunctionResponse has no field or method Diagnostics) ../../../go/pkg/mod/github.com/hashicorp/terraform-plugin-framework@v1.5.0/internal/toproto5/diagnostics.go:39:24: tfprotov5Diagnostic.FunctionArgument undefined (type tfprotov5.Diagnostic has no field or method FunctionArgument) FAIL terraform-provider-hashicups-pf/internal/provider [build failed]

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example:

  1. git clone hashicups
  2. git checkout test
  3. TF_ACC=1 go test -count=1 -v
bflad commented 8 months ago

Hi @brownwk 👋 Thank you for raising this issue and sorry for the trouble! I will look into the current state of the hashicups tutorial repository to prevent this for others in the future, but this appears to be related to some co-dependent github.com/hashicorp/terraform-plugin-* Go module updates that need to occur within that repository or the tutorial instructions.

To immediately unblock you, can you try running the following from inside the hashicups repository directory:

go get github.com/hashicorp/terraform-plugin-framework@v1.6.1
go mod tidy

This will update the terraform-plugin-framework dependency to the latest version, which should still work as expected with the tutorial, while also resolving the Go errors.

Please let us know! Thank you.

bflad commented 8 months ago

Hi again, @brownwk 👋

The terraform-provider-hashicups repository has had its main branch and all tutorial-associated branches updated with the latest versions of terraform-plugin-* Go modules, which should prevent this problem going forward. You should now be able to either run the commands in my previous comment or pull down the latest commits to get those updates that should prevent the errors you saw.

Since this should be resolved now and there is nothing actionable in this repository, I'm going to close this issue, but please do reach out if you are still having trouble. Thanks!

github-actions[bot] commented 7 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.