From the course: HashiCorp Certified: Terraform Associate (003) Cert Prep by KodeKloud
Unlock this course with a free trial
Join today to access over 23,400 courses taught by industry experts.
Multiple providers - Terraform Tutorial
From the course: HashiCorp Certified: Terraform Associate (003) Cert Prep by KodeKloud
Multiple providers
- [Instructor] Now let's take a quick look at how to make use of multiple providers within a single Terraform configuration. Using multiple providers within the same configuration file allows us to provision resources, even those that belong to different platforms within the same configuration. Let us add another resource block to the local file resource block that we used in the previous lecture. Now our main.tf file has two resource blocks, one belonging to the local provider and another for the random provider. When we add resource block belonging to a provider that has not been used within the configuration before, we have to run the terraform init command again. In this example, we can see that the local provider was previously installed and will be reused. However, the plugin for the random provider will have to be downloaded and installed as it was not used before. The rest of these steps are the same irrespective of how many resources or providers are used within the Terraform…