Terraform kubernetes provider secret with .p12 file

I have to create a secret using .p12 keystore (binary file). If I am creating it as below-

resource "kubernetes_secret_v1" "app_keystore" {
  metadata {
    name = "app-keystore"
    namespace = "test"
  }
  type = "Opaque"
  data = {
   "test.p12"=file("./secret/appkeystore/test.p12")
  }
}

Error: Error in function call

│ on secret\secret.tf line 68, in resource “kubernetes_secret_v1” “app_keystore”:
│ 68: “test.p12”=file(“./secret/appkeystore/test.p12”)
│ ├────────────────
│ │ while calling file(path)

│ Call to function “file” failed: contents of
│ “./secret/appkeystore/test.p12” are not valid UTF-8; use the
│ filebase64 function to obtain the Base64 encoded contents or the other file
│ functions (e.g. filemd5, filesha256) to obtain file hashing results
│ instead.

With base64 encoding, the .p12 file is getting encoded twice.
Can anyone please help me in handling .p12 file in terraform?

Thanks in advance.

I’m guessing the binary_data argument of the kubernetes_secret_v1 resource is intended for this kind of situation - Terraform Registry