Acceptance Testing: External Provider

I want to load some external providers for acceptance testing. For Ex - Hashicorp TLS provider. Where should I specify this in config. I am getting error -

The following dependency selections recorded in the lock file are
inconsistent with the current configuration:
- provider Terraform Registry required by this configuration but no version is selected

Hi @sachin.saxena48 :wave: Thank you for reaching out.

When trying to use external providers with the more recent versions of the acceptance testing framework, you should include the external provider information via the helper/resource.TestCase type ExternalProviders field or helper/resource.TestStep type ExternalProviders field.

For example:

resource.Test(t, resource.TestCase{
	// keep the existing ProviderFactories, ProtoV5ProviderFactories, or ProtoV6ProviderFactories field
	// add the below to also support the hashicorp/random provider in TestStep.Config:
	ExternalProviders: map[string]resource.ExternalProvider{
		"random": {
			Source:  "hashicorp/random",
			Version: "3.3.2",
	Steps: []resource.TestStep{/* ... */},

This will ensure that when the testing framework calls terraform init, it knows about the extra providers in the test step configurations. Hope this helps.

Thanks for the response.