Local GO tests succeed but not in CI (using provider in CI works)

Hello community,

I have released a provider, which works perfectly fine when used within a Terraform configuration whether on my machine, Terraform Cloud or my CI (GitHub Actions).

However, I cannot run the automated tests on my CI (they work perfectly fine locally).

Since I don’t know Go, I am struggling to find out what the heck is going on with GitHub Actions (Ubuntu) and what do I need to do to make it work…

  • Did anybody have this problem before while working on their provider?
  • Anybody can help?

The provider in question: https://github.com/Olivr/terraform-provider-gpg

Output of the tests locally (OSX):

❯ go test -v -cover ./internal/provider/
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestAccResourcePrivateKey
--- PASS: TestAccResourcePrivateKey (15.96s)
PASS
coverage: 87.9% of statements
ok  	github.com/Olivr/terraform-provider-gpg/internal/provider	(cached)	coverage: 87.9% of statements

Output of the tests on CI (Ubuntu):

❯ go test -v -cover ./internal/provider/
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestAccResourcePrivateKey
2021/09/13 05:57:11 [WARN] Got error running Terraform: invalid character 'c' looking for beginning of value
    resource_private_key_test.go:26: Step 1/2 error: invalid character 'c' looking for beginning of value
2021/09/13 05:57:11 [WARN] Got error running Terraform: invalid character 'c' looking for beginning of value
    testing_new.go:63: Error retrieving state, there may be dangling resources: invalid character 'c' looking for beginning of value
--- FAIL: TestAccResourcePrivateKey (0.66s)
FAIL
coverage: 21.2% of statements
FAIL	github.com/Olivr/terraform-provider-gpg/internal/provider	0.671s
FAIL

Both running go1.17 and Terraform v1.0.6.

I believe this is this issue.

This looks a lot like this issue indeed!
Thank you @paddy