Using external resources from other Terraform state files
In the Obtaining external data with data sources recipe in Chapter 4, Using Terraform with External Data, we saw that it’s possible to retrieve information about resources already present in the infrastructure using data blocks.
In this recipe, we will learn that it is also possible to retrieve external information that is present in other Terraform state files.
Getting ready
For this recipe, we will, like the previous recipe, use a Terraform configuration that provisions an Azure App Service, which must be part of an already provisioned an App Service plan.
Unlike the previous recipe, we will not use individual data sources; instead, we will read outputs from an existing Terraform state that was used to provision the App Service plan.
As a prerequisite, in the Terraform configuration that was used to provision the App Service plan, we must have an output value (read the Using outputs to expose Terraform...