Loading...
Loading...
Expose values and query existing resources
data "azurerm_resource_group" "existing" {
name = "existing-rg"
}
resource "azurerm_virtual_network" "main" {
location = data.azurerm_resource_group.existing.location
resource_group_name = data.azurerm_resource_group.existing.name
}Use data sources to query existing infrastructure without managing it in Terraform.
data "azurerm_resource_group" "networking" {
name = "networking-rg"
}
output "rg_location" {
value = data.azurerm_resource_group.networking.location
}