sparse-intern-71089
07/30/2021, 12:39 PMtall-librarian-49374
07/30/2021, 12:44 PMnative:cache:listRedisKeys
call inside an apply, similar to https://github.com/pulumi/templates/blob/master/azure-typescript/index.ts#L18-L19tall-librarian-49374
07/30/2021, 12:45 PMancient-eve-13947
07/30/2021, 12:45 PMtall-librarian-49374
07/30/2021, 12:46 PMancient-eve-13947
07/30/2021, 12:47 PMtall-librarian-49374
07/30/2021, 12:50 PMimport * as pulumi from "@pulumi/pulumi";
import * as resources from "@pulumi/azure-native/resources";
import * as redis from "@pulumi/azure-native/cache";
const resourceGroup = new resources.ResourceGroup("rg");
var cache= new redis.Redis("redis", {
resourceGroupName: resourceGroup.name,
enableNonSslPort: true,
minimumTlsVersion: redis.TlsVersion.TlsVersion_1_2,
sku: {
name: "Basic",
family: "C",
capacity: 1
}
});
const keys= pulumi.all([resourceGroup.name, cache.name])
.apply(([resourceGroupName, name])=>redis.listRedisKeys({resourceGroupName, name}))
export const connectionString= pulumi.interpolate `${cache.hostName}:6380,password=${keys.primaryKey},ssl=True,abortConnect=False`;
ancient-eve-13947
07/30/2021, 12:50 PMtall-librarian-49374
07/30/2021, 12:50 PMancient-eve-13947
07/30/2021, 12:52 PMtall-librarian-49374
07/30/2021, 12:53 PMancient-eve-13947
07/30/2021, 12:53 PMancient-eve-13947
07/30/2021, 12:54 PMtall-librarian-49374
07/30/2021, 12:54 PMancient-eve-13947
07/30/2021, 12:55 PMancient-eve-13947
07/30/2021, 12:55 PMancient-eve-13947
07/30/2021, 12:55 PMtall-librarian-49374
07/30/2021, 12:55 PMall
to this:
const keys= pulumi.all([resourceGroup.name, cache.name, cache.id])
tall-librarian-49374
07/30/2021, 12:56 PMcache.id
won’t resolve until redis exists. But it may be worth filing an issue for your original code.ancient-eve-13947
07/30/2021, 12:56 PMancient-eve-13947
07/30/2021, 12:56 PMtall-librarian-49374
07/30/2021, 12:57 PMancient-eve-13947
07/30/2021, 12:57 PMtall-librarian-49374
07/30/2021, 12:57 PMancient-eve-13947
07/30/2021, 1:43 PMancient-eve-13947
07/30/2021, 2:15 PMconst resourceGroup= new resources.ResourceGroup(resourceGroupName);
for preview that looked fine, but when I run it, it leads to the creation of a new resourcegroup.
on the other hand, when I do
const resourceGroup= resources.getResourceGroup({resourceGroupName});
then the result is a `Promise<GetResourceGroupResult>`and I get compile-time errors.
when I try
const resourceGroup= await resources.getResourceGroup({resourceGroupName});
I get another error saying that top-level await is not allowed.
So what do I do?ancient-eve-13947
07/30/2021, 2:16 PMtall-librarian-49374
07/30/2021, 2:38 PM