I want to get the ip address in terraform as shown in the image.
Howzit @laguz1254
removed previous reply
I see you have a solution from the github repo
for people reading here only and in case that reply is removed
You can use hashicorp/dns provider to get this IP address by default hostname.
For example:
resource "azurerm_linux_web_app" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_service_plan.example.location
service_plan_id = azurerm_service_plan.example.id
site_config {}
}
data "dns_a_record_set" "app_ip_address" {
host = azurerm_linux_web_app.example.default_hostname
}
resource "azurerm_dns_a_record" "dns_a" {
# ...
target_resource_id = data.dns_a_record_set.app_ip_address.addrs[0]
}