I am trying to convert an ARM template to pulumi ```"name": "AzureWebJobsStorage", "v...
g
I am trying to convert an ARM template to pulumi
Copy code
"name": "AzureWebJobsStorage",
              "value": "[format('DefaultEndpointsProtocol=https;AccountName={0};EndpointSuffix={1};AccountKey={2}', parameters('project'), environment().suffixes.storage, listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('project')), '2020-08-01-preview').keys[0].value)]"
pulumi AI converted it like this
Copy code
// Create an Azure Storage Account
const storageAccount = new azureNative.storage.StorageAccount("storageAccount", {
    resourceGroupName: resourceGroup.name,
    sku: {
        name: "Standard_LRS",
    },
    kind: "StorageV2",
});

// Get the primary connection string for the storage account
const storageAccountKeys = storageAccount.name.apply(name =>
    azureNative.storage.listStorageAccountKeys({
        resourceGroupName: resourceGroup.name,
        accountName: name,
    })
);

const primaryConnectionString = pulumi.interpolate`DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${storageAccountKeys.keys[0].value};EndpointSuffix=<http://core.windows.net|core.windows.net>`;
is this a common thing in Azure client to construct strings like this? Are there no relevant outputs?
b
There's a dedicated converter for ARM. Perhaps that suits you better than going through AI. https://github.com/pulumi/pulumi-converter-arm
g
yeah I tried that already, it works pretty much like terraform converter … it doesn’t 🤷 - well to be fair it doesn’t support the most resources. though I got lucky and asnwered my own question https://github.com/pulumi/examples/blob/master/azure-ts-functions/helpers.ts ---> yes you have to construct these strings yourself