better-shampoo-48884
03/29/2021, 5:40 PMaksStack.cluster[thisCluster.name].kubeconfig = await azure.containerservice.listManagedClusterAdminCredentials({resourceGroupName: aksStack.parameters.name, resourceName: aksStack.cluster[thisCluster.name].parameters.name})
And the reason from the error message is that the cluster it refers to (in this case the one named aks.paramters.name
) doesn't exist. Because of course it doesn't. I've tried using aks.name
, aks.name.apply(name => name)
, pulumi.interpolate`${aks.name}` (where aks is the result of the creation of the cluster resource) to try to ensure that there's a dependency - but it seems pulumi just doesn't care. I must be missing something obvious - and I can't set "dependsOn" for this either because it's not a resource, so.. thoughts?Error: invocation of azure-native:containerservice:listManagedClusterAdminCredentials returned an error: request failed /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.ContainerService/managedClusters/{resourceName}' under resource group '<rg>' was not found. For more details please go to <https://aka.ms/ARMResourceNotFoundFix>"
aksStack.cluster[thisCluster.name].parameters = {
name: aks.name.apply(name => name),
id: aks.id.apply(id => id)
}
const aks = new azure.containerservice.ManagedCluster(thisCluster.name, aksStack.cluster[thisCluster.name].conf)
Using thisCluster.name for the listManagedClusterAdminCredentials brings the same error, just this time it lists the name as it should be created.billowy-army-68599
03/29/2021, 5:58 PMapply
on the kubeconfig
parameter rather than the namebetter-shampoo-48884
03/30/2021, 6:14 AMconst aks = new azure.containerservice.ManagedCluster(thisCluster.name, aksStack.cluster[thisCluster.name].conf)
aksStack.cluster[thisCluster.name].resource = aks;
aksStack.cluster[thisCluster.name].parameters = {
name: aks.name.apply(name => name),
id: aks.id.apply(id => id)
}
// above is perfectly fine, succeeds without a problem - note though that this stack currently has no AKS cluster, the "up" command would create it as it does not yet exist.
// next follows creation & attachment of node pools to the aks cluster - irrelevant for this. Then, as the last bit of code for the cluster block, I get the kubeconfig of the newly created cluster:
aksStack.cluster[thisCluster.name].kubeconfig = await azure.containerservice.listManagedClusterAdminCredentials({resourceGroupName: aksStack.parameters.name, resourceName: aksStack.cluster[thisCluster.name].parameters.name})
aksStack.cluster.kubeConfig = pulumi.unsecret(aksStack.cluster[thisCluster.name].kubeconfig);
// somehow the above code is exectued before -any-other-pulumi-operation-
preview
stage ?! why does it try to execute this at the preview stage?λ pulumi preview --suppress-outputs
Previewing update (dev.infra.infratesting):
Type Name Plan Info
pulumi:pulumi:Stack baseline-infra-dev.infra.infratesting 1 error; 27 messages
+ ├─ random:index:RandomUuid aks-to-des-RA create
+ ├─ random:index:RandomUuid aks-to-acr-RA create
+ ├─ random:index:RandomUuid des-to-kv-RA create
+ ├─ random:index:RandomString aksWindowsUser create
+ ├─ random:index:RandomPassword aksWindowsPass create
+ ├─ random:index:RandomString aksLinuxUser create
+ ├─ random:index:RandomString diskKeyName create
+ ├─ azure-native:containerregistry:Registry <grp>acr create
+ ├─ azure-native:network:PublicIPAddress x39482appgw-publicIp create
+ ├─ azure-native:keyvault:Key aks-des-key create
+ ├─ azure-native:compute:DiskEncryptionSet aks-des create
+ ├─ azure-native:network:ApplicationGateway x39482appgw create
+ ├─ azure-native:authorization:RoleAssignment des-to-kv create
+ ├─ azure-native:containerservice:ManagedCluster infratest-k8s create
+ ├─ azure-native:authorization:RoleAssignment aks-to-acr create
+ ├─ azure-native:authorization:RoleAssignment aks-to-des create
+ └─ azure-native:containerservice:AgentPool spot00 create
Diagnostics:
pulumi:pulumi:Stack (baseline-infra-dev.infra.infratesting):
unhandled rejection: CONTEXT(3401): Invoking function: tok=azure-native:containerservice:listManagedClusterAdminCredentials asynchronously
STACK_TRACE:
Error:
at Object.debuggablePromise (c:\dev\<pulumi-path>\baseline-infra\node_modules\@pulumi\pulumi\runtime\debuggable.js:69:75)
at c:\dev\<pulumi-path>\baseline-infra\node_modules\@pulumi\pulumi\runtime\invoke.js:126:45
at Generator.next (<anonymous>)
at fulfilled (c:\dev\<pulumi-path>\baseline-infra\node_modules\@pulumi\pulumi\runtime\invoke.js:18:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
(this is repeaded for a total of three times)
error: Running program 'c:\dev\<pulumi-path>\baseline-infra' failed with an unhandled exception:
Error: invocation of azure-native:containerservice:listManagedClusterAdminCredentials returned an error: request failed /subscriptions/<sub>/resourceGroups/<grp>_westeurope/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.ContainerService/managedClusters/{resourceName}' under resource group '<grp>_westeurope' was not found. For more details please go to <https://aka.ms/ARMResourceNotFoundFix>"
at Object.callback (c:\dev\<pulumi-path>\baseline-infra\node_modules\@pulumi\pulumi\runtime\invoke.js:139:33)
at Object.onReceiveStatus (c:\dev\<pulumi-path>\baseline-infra\node_modules\@grpc\grpc-js\src\client.ts:334:26)
at Object.onReceiveStatus (c:\dev\<pulumi-path>\baseline-infra\node_modules\@grpc\grpc-js\src\client-interceptors.ts:426:34)
at Object.onReceiveStatus (c:\dev\<pulumi-path>\baseline-infra\node_modules\@grpc\grpc-js\src\client-interceptors.ts:389:48)
at c:\dev\<pulumi-path>\baseline-infra\node_modules\@grpc\grpc-js\src\call-stream.ts:276:24
at processTicksAndRejections (node:internal/process/task_queues:76:11)
listManagedClusterAdminCredentials
at that stage?! even before the cluster it needs to get its credentials from is created? Is it because I have the kubeconfig as part of the output?pulumi preview
executes ilstManagedClusterAdminCredentials
even though it is currently planning on creating the resource on which that function depends?tall-librarian-49374
03/30/2021, 7:34 AMbetter-shampoo-48884
03/30/2021, 8:46 AM