# Acceptance Testing: External Provider

**URL:** <https://discuss.hashicorp.com/t/acceptance-testing-external-provider/42400>\
**Category:** Plugin Development\
**Tags:** testing\
**Created:** [July 25, 2022, 3:30pm UTC](https://discuss.hashicorp.com/t/acceptance-testing-external-provider/42400 "2022-07-25T15:30:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sachin.saxena48](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/sachin.saxena48/32/23958_2.png) [@sachin.saxena48](https://discuss.hashicorp.com/u/sachin.saxena48)\
**Post date:** [July 25, 2022, 3:30pm UTC](https://discuss.hashicorp.com/t/acceptance-testing-external-provider/42400/1 "2022-07-25T15:30:11Z")

</div>

I want to load some external providers for acceptance testing. For Ex - [Hashicorp TLS provider](http://registry.terraform.io/hashicorp/tls). 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](http://registry.terraform.io/hashicorp/tls:) required by this configuration but no version is selected

---

<div class="post-metadata">

**Author:** ![bflad](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/bflad/32/922_2.png) [@bflad](https://discuss.hashicorp.com/u/bflad)\
**Post date:** [August 16, 2022, 3:51pm UTC](https://discuss.hashicorp.com/t/acceptance-testing-external-provider/42400/2 "2022-08-16T15:51:46Z")

</div>

Hi @sachin.saxena48 👋 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](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#TestCase.ExternalProviders) or [`helper/resource.TestStep` type `ExternalProviders` field](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource#TestStep.ExternalProviders).

For example:

```go
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.

---

<div class="post-metadata">

**Author:** ![sachin.saxena48](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/sachin.saxena48/32/23958_2.png) [@sachin.saxena48](https://discuss.hashicorp.com/u/sachin.saxena48)\
**Post date:** [August 17, 2022, 4:01am UTC](https://discuss.hashicorp.com/t/acceptance-testing-external-provider/42400/3 "2022-08-17T04:01:20Z")

</div>

> [@bflad](#):
>
> `ExternalProviders:`

Thanks for the response.
