Terraform v0.13 discovery of providers in the local filesystem

Hi all,

Today i sat down and wanted to give v0.13.0-rc1 a try. I have a local provider that i need to use. Followed this guide: https://github.com/hashicorp/terraform/blob/guide-v0.13-beta/draft-upgrade-guide.md#new-filesystem-layout-for-local-copies-of-providers. Can’t figure out why tf decides not to use the plugin even though it already finds it at where it looks for.

Full log: https://gist.github.com/igungor/5553dae1e2010df15b214662a3abbbde

What am I missing? Should I file an issue?

Hi @igungor,

(I’ve moved this into a separate topic just because it’s becoming hard to follow all of the separate threads of conversation in the beta program topic.)

The directory structure you created tells Terraform that your provider’s source address is registry.example.com/peak/snowflake, but it looks like at least one of your modules isn’t declaring that as the source address and so Terraform is defaulting to registry.terraform.io/hashicorp/snowflake, which doesn’t exist.

To make this work, you need to also declare the source address for the provider in each of the modules that uses it:

terraform {
  required_providers {
    snowflake = {
      source  = "registry.example.com/peak/snowflake"
      version = ">= 0.13.2"
    }
  }
}

The above tells Terraform “In this module, the name snowflake refers to registry.example.com/peak/snowflake, and version 0.13.2 or later of that provider is required.”

With that declaration in place, Terraform will know that a provider "snowflake" block or a declaration of a resource with a type name starting with snowflake_ should be handled by your local provider, rather than a hypothetical official provider called “snowflake”.

Thanks @apparentlymart for the prompt and detailed response. That did the trick!