Is it possible to get the full path from a azurerm_netapp_volume data source?

4/30/2020

I want to create a persistent volume using Terraform, like this:

...
persistent_volume_source {
    nfs {
        path = "/${data.azurerm_netapp_volume.my_netapp_volume.volume_path}"
        server = data.azurerm_netapp_volume.my_netapp_volume.volume_path
    }
}
...

The Azure Netapp Volume already exists. The problem is that my mount path looks like 1.2.3.4:/my-netapp-volume and the terraform plan ends up with something like this:

          + persistent_volume_source {

              + nfs {
                  + path   = "/my-netapp-volume"
                  + server = "my-netapp-volume"
                }
            }

Is it possible to somehow get the 1.2.3.4 part of my path?

-- Daniel
kubernetes
terraform
terraform-provider-azure
terraform-provider-kubernetes

1 Answer

5/4/2020

As it shows, the server property of the Kubernetes persistent volume should be set the value with an IP address of the NetApp volume. But you set the with its path.

So what you need to is to find the IP address of the NetApp volume. I suggest you output all the information of your NetApp volume by adding the code like this:

output "netapp-volume" {
  value = data.azurerm_netapp_volume.my_netapp_volume
}

If it shows the IP address in the mount targets, then you can put it as the server value. If it does not show it, then you can only set the server value with the IP address of the NetApp volume manually. To get it, you can use the Azure CLI command az netappfiles volume show.

-- Charles Xu
Source: StackOverflow