Hello everyone I'm running into an issue when usin...
# general
p
Hello everyone I'm running into an issue when using the output of a resource in an ARM template (Typescript). For example, this is the variables section of the ARM template
Copy code
"variables": {
      "storageAccountName": config.appServicePlanStorageName,
      "storageAccountKey": appStorageAccount.primaryAccessKey,
      "location": config.location,
}
Note that
storageAccountKey
is gotten from another resource When the resource got deployed, the value of storageAccountKey was this:
Copy code
Calling [toJSON] on an [Output<T>] is not supported.\\n\\nTo get the value of an Output as a JSON value or JSON string consider either:\\n    1: o.apply(v => v.toJSON())\\n    2: o.apply(v => JSON.stringify(v))\\n\\nSee <https://pulumi.io/help/outputs> for more details.\\nThis function may throw in a future version of @pulumi/pulumi.
I have tried
"storageAccountKey": appStorageAccount.primaryAccessKey.apply(v => JSON.stringify(v))
"storageAccountKey": pulumi.output(appStorageAccount.primaryAccessKey).apply(JSON.stringify)
`"storageAccountKey": pulumi.all([appStorageAccount.primaryAccessKey]).apply(([v]) => 
${v}
)`
t
You need to resolve outputs before you start defining a JSON object
E.g.
pulumi.all([config.appServicePlanStorageName, appStorageAccount.primaryAccessKey]).apply(([name, key]) => /* use name and key in JSON object*/
p
Thanks, works fine now