Hi All,
I want to assign only the value of ipaddress which is extracted by data block, can’t able to get the solution for this. can i get some suggestion please.
Basically i am trying to get these from public ip address which has couple of filters and i want to pass this ipaddres to my provisioner block to perform some remote exec.
data "azurerm_public_ip" "test" {
depends_on = [azurerm_public_ip.pip]
for_each = { for k,v in local.all_vm_collection : k => v
if lookup(v, "enable_public_ip_address",false) && v.Type == "Linux"
}
name = format("%s-pip",each.key)
resource_group_name = each.value.resource_group_name
}
I am getting the expected output as below:
{
“agp-jmp-srv2-vm” = {
“allocation_method” = “Static”
“domain_name_label” = “”
“fqdn” = “”
“id” = “********agp-jmp-srv2-vm-pip”
“idle_timeout_in_minutes” = 4
“ip_address” = “20.195.35.210”
“ip_version” = “IPv4”
“location” = “southeastasia”
“name” = “agp-jmp-srv2-vm-pip”
“resource_group_name” = “agp-sap-rg”
“reverse_fqdn” = “”
“sku” = “Standard”
“tags” = {
“CreatedBy” = “Terraform”
“CustomerName” = “AGP”
“Resourcetype” = “PublicIP”
}
“zones” =
}
}
How could i acheive this?