Error with AKS: var.ssh_public_key is "~/.ssh/"

Hello all - i am getting this error when creating a AKS resource , i have created AKS several times and have not seen this error in the past. some solutions suggest creating a ssh pair and uploading it in the location but that doesnt sound like an elegant solution. Especially when no documentation suggests that we wouldnt need to do that

Error: Invalid function argument

  on line 37, in resource "azurerm_kubernetes_cluster" "main":
  37:       key_data = file(var.ssh_public_key)
    | var.ssh_public_key is "~/.ssh/"

Invalid value for "path" parameter: no file exists at
C:\Users\.ssh\; this function works only with files that are
distributed as part of the configuration source code, so if this file will be
created by a resource in this configuration you must instead obtain this
result from an attribute of that resource.

Do you see the public key available in your .ssh folder? I think it might be missing and having one there might help to fix this.

I’m no Windows user but I see that terraform is interpreting ~/.ssh/ as C:\Users.ssh\ which doesn’t look right to me. Maybe provide the path using windows-style paths?