hi everyone
i try to find out, how i can get in my main.tf file, where i make a vnet peering, after i have create a Azure AADDS, my remote_virtual_network_id. I dont want to hardcode that, so how i can get this info into a output or variable or something similar?
my code now is:
resource “azurerm_virtual_network_peering” “vnetpeering1” {
name = “N4K-TO-AADS”
resource_group_name = var.rg
virtual_network_name = var.vnet-n4k
remote_virtual_network_id = “/subscriptions/blablabla/aadds-vnet”
allow_virtual_network_access = true
allow_forwarded_traffic = true
}
resource “azurerm_virtual_network_peering” “vnetpeering2” {
name = “AADS-TO-N4K”
resource_group_name = var.rg
virtual_network_name = var.vnet-aadds
remote_virtual_network_id = “/subscriptions/blablabla/n4k-v01-we-vn-001”
allow_virtual_network_access = true
allow_forwarded_traffic = true
i dont make that in the same step as i create all the other ressources, because AADD i must create seperate, and than i must peer that vnet with my own vnet. so i must find i way to get the correct .ID from my subscription than. anyone who can help?
regards
frank