sparse-intern-71089
07/08/2021, 6:48 PMbillowy-army-68599
REDIS_CONNECTION_STRING to? can you share more of your code?adventurous-camera-87788
07/08/2021, 6:52 PMbillowy-army-68599
crooked-parrot-53351
07/12/2021, 3:04 PMconst redis = new cache.Redis(redisInstanceName, {
name: redisInstanceName,
redisVersion: `${redisInstanceVersion}`,
enableNonSslPort: false,
location: resourceGroup.location,
minimumTlsVersion: `${redisInstanceMinTlsVersion}`,
resourceGroupName: resourceGroup.name,
sku: {
capacity: parseInt(redisInstanceSKUCapacity),
family: `${redisInstanceSKUFamily}`,
name: `${redisInstanceSKUName}`
}
});
const redisHostName = redis.hostName.apply(t => t);
const redisPrimaryKey = redis.accessKeys.apply(accessKeys => accessKeys.primaryKey);
const redisSslPort = redis.sslPort.apply(t => t);
const REDIS_CONNECTION_STRING = pulumi.interpolate`rediss://:${redisPrimaryKey}@${redisHostName}:${redisSslPort}`;
const azfInstance = new azure_native.web.WebApp(
azureFunctionName,
{
name: azureFunctionName,
kind: 'functionapp',
location: resourceGroup.location,
resourceGroupName: resourceGroup.name,
serverFarmId: appServicePlan.id,
storageAccountName: storageAccount.name,
storageAccountAccessKey: storageAccount.primaryAccessKey,
siteConfig: {
appSettings: [
...
{name: 'REDIS_CONNETION_STRING', value: REDIS_CONNECTION_STRING},
...
],
nodeVersion: `${WEBSITE_NODE_DEFAULT_VERSION}`
}
}
);
We're using the Typescript SDK. You can see we moved past the error above, but we're now getting output<string> as the value of REDIS_CONNECTION_STRING when looking at the diff from a dry run of pulumi up. I've tried attaching the Node debugger and stepping through the code, but navigating the Proxy relationships have proved complicated for us.billowy-army-68599
crooked-parrot-53351
07/12/2021, 3:54 PMconst REDIS_CONNECTION_STRING = pulumi.all([redis.hostName, redis.accessKeys.primaryKey, redis.sslPort]).apply(([hostName, primaryKey, sslPort])=> {
return `rediss://:${primaryKey}@${hostName}:${sslPort}`;
})
and updated the section to use interpolate as the link showed:
{name: 'REDIS_CONNECTION_STRING', value: pulumi.interpolate`${REDIS_CONNECTION_STRING}`},
and I ran into the same issue. Is this along the lines of your suggestion?crooked-parrot-53351
07/12/2021, 4:09 PMaccessKeys portion and build the string w/just hostname and port, all works as expected. Are there good practices for nested keys like accessKeys.primaryKey ?billowy-army-68599
crooked-parrot-53351
07/12/2021, 5:31 PM@pulumi/azure-native/cache/v20201201 as our dependency version though.crooked-parrot-53351
07/12/2021, 5:32 PMaccessKeys and the type in the TS files distributed with the SDK, I'm just not sure why they're not resolving 😞billowy-army-68599
billowy-army-68599
crooked-parrot-53351
07/12/2021, 6:08 PMbillowy-army-68599
crooked-parrot-53351
07/14/2021, 2:37 AMpulumi up didn't need to update the Redis service due to no changes being needed.
For those searching, the solution here was to use the listRedisKeys function from the cache namespace to explicitly query for the keys needed to build the connection string.