Terraform uses providers to talk with different clouds, they are plugins to that particular cloud plugins. In our previous example we have used provider local, this provider is created by HashiCorp. There are three tiers of providers.

- Official providers – written , tested and maintained by HashiCorp
- HashiCorp partner – Owned and maintained by Third party companies which has a partnership HashiCorp and they are maintained by 3rd party company.
- Community – Published and maintained by the members of HashiCorpcommunity.
You can see all the installed plugins in the .terraform folder from where you have executed the init command. You can differentiate between official and third-party plugin by looking at the output of the init command, in our previous example we had seen hashicorp/local the first part before space specifies the organization and the last part specifies the type.
By default, terraform will pull in the latest terraform plugins when we run init command. The official terraform registry can be located at Browse Providers | Terraform Registry
Example with two providers
Let us try out an example with two providers which will create a random string and also a local file, once we run the init and apply command we will see the result .
resource "local_file" "hello"{
filename = "hello_world.txt"
content = "Hello, World! from terraform"
}
resource "random_string" "example" {
length = 8
special = false
}


As you can see terraform has downloaded random provider as well as local provider.
This is one of the way in which you can talk to multiple providers(AWS , GCP , onPrem ) from one place and describe the architecture of entire enterprise / group / application ecosystem.
Caution
Whenever we run terraform init , it pulls the latest plugins from the registry and sometimes it may happen that it could break your build because of changes within the provider. It is always better to lock your provider at a fixed version instead of updating every time. We will see the same in upcoming posts.
Links
- Repository – srnyapathi/tflabs_hello_world
- Plugin Registry – Browse Providers | Terraform Registry



