"Error: Invalid template interpolation value" when passing map(string) into powershell command

Hi community,
I’m running a powershell scripts on my terraform script to create resources on azure and am having problems passing in map(string) as a parameter to the ps script.

The powershell script itself changes some subscription key values that are passed in as a parameter into the script. When i run this from the powershell cli, i have no problems passing in a hashtable. However when running it on terraform i get

“Error: Invalid template interpolation value: Cannot include the given value in a string template: string required.”

I am aware that terraform cannot interpolate a map(string) as a string, so hence the interpolation error. My question is then, how do we add a hashtable variable to a powershell command in terraform?

the command that i run is:
provisioner “local-exec” {
command = “./Scripts/SetSubscriptionsKeys.ps1 -resourceGroupName {azurerm_resource_group.rg.name} -apimServiceName {azurerm_api_management.apim.name} -adminSubscriptionKeys ${var.subscriptionKeys}”
interpreter = [“PowerShell”, “-Command”]
}

Thank you for your help.

Best regards,
Rui Vaz

Figured it out. To those interested, at least for terraform 0.12.13 what you can do is declare the variable as a string, and write down the splatted hash as the variable. When terraform interpolation kicks in, it removes the double quotes, so the powershell script receives the hashtable not as a string, but as a literal hashtable…
this terraform parser is a bit quirky if you ask me.