Hi,
I am in the process of updating the OpenAPI Terraform provider to Terraform SDK 2.0 and the integration tests are no longer working. The int tests are configured to use the OpenAPI provider source code (via setting the ProviderFactories field) as shown below; however the errors I am getting seem to suggest that the binary located at ~/.terraform.d/plugins is being used instead.
p := openapi.ProviderOpenAPI{ProviderName: "openapi"}
var testAccProviders = map[string]func() (*schema.Provider, error){
providerName: func() (*schema.Provider, error) {
return provider, nil
},
}
resource.Test(t, resource.TestCase{
ProviderFactories: testAccProviders,
....
Error returned when running the integration test:
testing_new.go:79: init failed: 2020/10/04 10:10:16 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
Provider "openapi" not available for installation.
A provider named "openapi" could not be found in the Terraform Registry.
This may result from mistyping the provider name, or the given provider may
be a third-party provider that cannot be installed automatically.
In the latter case, the plugin must be installed manually by locating and
downloading a suitable distribution package and placing the plugin's executable
file in the following directory:
terraform.d/plugins/darwin_amd64
Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".
Error: no provider exists with the given name
Reading the Terraform testing docs How Acceptance Tests Work, I noticed the following:
Provider acceptance tests run real Terraform commands using a Terraform CLI binary, approximating as closely as possible the experience of using the provider under test with Terraform in production. We refer to this functionality as the "binary test driver".
However, I am not clear whether that means that the provider under test is also the real binary or the source code one. In previous versions of the SDK (before 2.0) the plugin under test was the one provided in the ProviderFactories or Providers fields in the resource.TestCase struct which also allowed me to set up breakpoints and debug any issues more easily.
Any help or pointers here would be much appreciated it!
Thanks,
Dani