I'm going through the Kubernetes Guides published ...
# typescript
c
I'm going through the Kubernetes Guides published by Pulumi (https://github.com/pulumi/kubernetes-guides) and getting some strange typescript errors causing failure to compile when running pulumi up. I searched here and everywhere else I can find, but nothing useful has cropped up, so I'm hoping to find some help. I've got a local minikube cluster up and running, azure cli is logged in, etc. Some pulumi up commands will work, so it's not a global problem. npm is installed, and pulumi SDK.
Copy code
$ pulumi up
Previewing update (identity)

View Live: <https://app.pulumi.com/dangersorus/k8s-az-identity/identity/previews/7d98c3c1-8011-4cef-af17-b168d33489e7>

     Type                 Name                      Plan       Info
 +   pulumi:pulumi:Stack  k8s-az-identity-identity  create     1 error

Diagnostics:
  pulumi:pulumi:Stack (k8s-az-identity-identity):
    error: Running program '/Users/admin/Documents/workspace/k8s-cluster/01-identity' failed with an unhandled exception:
    TSError: ⨯ Unable to compile TypeScript:
    index.ts(114,39): error TS2339: Property 'objectId' does not exist on type 'Promise<GetClientConfigResult>'.
    index.ts(139,13): error TS2339: Property 'objectId' does not exist on type 'Promise<GetUserResult>'.

        at createTSError (/Users/admin/Documents/workspace/k8s-cluster/01-identity/node_modules/ts-node/src/index.ts:261:12)
        at getOutput (/Users/admin/Documents/workspace/k8s-cluster/01-identity/node_modules/ts-node/src/index.ts:367:40)
        at Object.compile (/Users/admin/Documents/workspace/k8s-cluster/01-identity/node_modules/ts-node/src/index.ts:558:11)
        at Module.m._compile (/Users/admin/Documents/workspace/k8s-cluster/01-identity/node_modules/ts-node/src/index.ts:439:43)
        at Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
        at Object.require.extensions.<computed> [as .ts] (/Users/admin/Documents/workspace/k8s-cluster/01-identity/node_modules/ts-node/src/index.ts:442:12)
        at Module.load (node:internal/modules/cjs/loader:948:32)
        at Function.Module._load (node:internal/modules/cjs/loader:789:14)
        at Module.require (node:internal/modules/cjs/loader:972:19)
        at require (node:internal/modules/cjs/helpers:88:18)
and then a different error code here
Copy code
$ pulumi stack select
Please choose a stack, or create a new one: infra
$ pulumi up
Previewing update (infra)

View Live: <https://app.pulumi.com/dangersorus/k8s-az-infra/infra/previews/55b69106-e31c-4dc9-902a-3f804174a9cb>

     Type                 Name                Plan       Info
 +   pulumi:pulumi:Stack  k8s-az-infra-infra  create     1 error

Diagnostics:
  pulumi:pulumi:Stack (k8s-az-infra-infra):
    error: Running program '/Users/admin/Documents/workspace/k8s-cluster/02-managed-infra' failed with an unhandled exception:
    TSError: ⨯ Unable to compile TypeScript:
    index.ts(1,24): error TS2307: Cannot find module '@pulumi/azure'.

        at createTSError (/Users/admin/Documents/workspace/k8s-cluster/node_modules/ts-node/src/index.ts:261:12)
        at getOutput (/Users/admin/Documents/workspace/k8s-cluster/node_modules/ts-node/src/index.ts:367:40)
        at Object.compile (/Users/admin/Documents/workspace/k8s-cluster/node_modules/ts-node/src/index.ts:558:11)
        at Module.m._compile (/Users/admin/Documents/workspace/k8s-cluster/node_modules/ts-node/src/index.ts:439:43)
        at Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
        at Object.require.extensions.<computed> [as .ts] (/Users/admin/Documents/workspace/k8s-cluster/node_modules/ts-node/src/index.ts:442:12)
        at Module.load (node:internal/modules/cjs/loader:948:32)
        at Function.Module._load (node:internal/modules/cjs/loader:789:14)
        at Module.require (node:internal/modules/cjs/loader:972:19)
        at require (node:internal/modules/cjs/helpers:88:18)
If anyone can point me in the direction of an answer to this, it would really make my entire week
Also noting the possibility that it's a typescript error in the provided code, given that if I load this into the TypeScript Playground, it finds a ton of errors. https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAKjgQwM4oF4FcoFM4BmUEIcARAAJhYA2WIwA9MtnmQNwBQoksiK6FjlzIAJoWKlK1Og2asRojt3DR4SNHBn1gEkuSq0djbQ2U81-TVGQA7UfqL7pRuTfsllnAMYRbqeFtkEHwAXi1XYAA6AHNcGAAFYgArXG8YAAoASi5ORkY4AGE8ZBh8GAALfFRcKAA3WpQwMBpgb1LgPzhgWzgAQQV+gBEonz8Appa2jr8AZVqGq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54gBxREUPw8dgDUg7tAMg-xErVAgHu0o3QYB5AKO0XorRbAnoZQEDo3g4ABgSI7B9yBGULFdq2Q5ogABC1M7B6mVn2qAMRD0wGPeqO9zql4KCHnenY6zFwhCRb6uFGH9yyr+P8iNZ4qPRsRTAWNJcNpQhGbOsAjHzTEH3EMctPQ9VHCnCnCkqHj2nqRe7S9miS25FQXAKVODCh+F3BbcIY6J24FiPELlinbDKeyDa323gcB4CRR6re895NIp08pqIEBqSpHSPGGTtq6kMH8FhsFogohsfnWINzqBmTnz+PzCkphgAQj8z0ALW0Qh8gFDIksRmoAmcSFG6mW1vk6yQMUEQRtQOgpqksZcfQRh9tELgOoHnXXbGBC8edi7yt1EC5ZQrZnqaCZCBSdhjWKC4AAB7BBaBp3wIBBJ6SFmKQEHXUZVKwPyKAqwyjoB401raybbYUgAIrJBRLUdyABCDs0nOAIEYCglzjX57Va83EGAtXagZBay8NrNBpsUmpuzXrA3wD7nHZ4QlznfaNfQKOhQ2wfNkGB8180IXyBhYhFDmLvJ5umlkQUPoBHyo8o2A7fr5zDjmxCY0H0e78A7s5KMEsjXbP2e9IM80mXiZWmbH13g8AdQmvQPbJYEAnZLF-V21AnB+ts7ky51jtbpvzwl8OqI-MuAi8sLJsQT9DHiFU5i7pStcXyyOE54XrOlcuZV0rWMzdW7z3td-WedMogJurgrw3fBleiC5Wrq7mvMH0Z18Q9FjvRcu7d80c38RLdgC9Sm739vcD+6N77MQbG+iiH81d5PUWacOZgPrxXzvjeiDYytkHRkKuoAz3T0QXAgA
b
the
@pulumi/azure
error can be fixed by doing
npm install @pulumi/azure
can you share the code you currently have?
c
`import * as azure from "@pulumi/azure"; import * as azuread from "@pulumi/azuread"; import * as pulumi from "@pulumi/pulumi"; import * as random from "@pulumi/random"; const name = pulumi.getProject(); // Create the server application in Azure AD. const applicationServer = new azuread.Application(
${name}-app-server
, { replyUrls: ["http://k8s_server"], type: "webapp/api", groupMembershipClaims: "All", requiredResourceAccesses: [ // Windows Azure Active Directory API { resourceAppId: "00000002-0000-0000-c000-000000000000", resourceAccesses: [{ // DELEGATED PERMISSIONS: "Sign in and read user profile" id: "311a71cc-e848-46a1-bdf8-97ff7156d8e6", type: "Scope", }], }, // MicrosoftGraph API { resourceAppId: "00000003-0000-0000-c000-000000000000", resourceAccesses: [ // APPLICATION PERMISSIONS: "Read directory data" { id: "7ab1d382-f21e-4acd-a863-ba3e13f7da61", type: "Role", }, // DELEGATED PERMISSIONS: "Sign in and read user profile" { id: "e1fe6dd8-ba31-4d61-89e7-88639da4683d", type: "Scope", }, // DELEGATED PERMISSIONS: "Read directory data" { id: "06da0dbc-49e2-44d2-8312-53f166ab848a", type: "Scope", }, ], }, ], }); const principalServer = new azuread.ServicePrincipal(
${name}-sp-server
, { applicationId: applicationServer.applicationId, }); // Generate a strong password for the Service Principal. const passwordServer = new random.RandomString(
${name}-pwd-server
, { length: 20, special: true, }, {additionalSecretOutputs: ["result"]}).result; const spPasswordServer = new azuread.ServicePrincipalPassword(
${name}-sppwd-server
, { servicePrincipalId: principalServer.id, value: passwordServer, endDate: "2099-01-01T000000Z", }); const applicationClient = new azuread.Application(
${name}-app-client
, { replyUrls: ["http://k8s_server"], type: "native", requiredResourceAccesses: [ // Windows Azure Active Directory API { resourceAppId: "00000002-0000-0000-c000-000000000000", resourceAccesses: [{ // DELEGATED PERMISSIONS: "Sign in and read user profile" id: "311a71cc-e848-46a1-bdf8-97ff7156d8e6", type: "Scope", }], }, // AKS ad application server { resourceAppId: applicationServer.applicationId, resourceAccesses: [{ // Server app Oauth2 permissions id id: applicationServer.oauth2Permissions[0].id, type: "Scope", }], }, ], }); const principalClient = new azuread.ServicePrincipal(
${name}-sp-client
, { applicationId: applicationClient.applicationId, }); // Generate a strong password for the Service Principal. const passwordClient = new random.RandomString(
${name}-pwd-client
, { length: 20, special: true, }, {additionalSecretOutputs: ["result"]}).result; const spPasswordClient = new azuread.ServicePrincipalPassword(
${name}-sppwd-client
, { servicePrincipalId: principalClient.id, value: passwordClient, endDate: "2099-01-01T000000Z", }); // Define a resource group (shared for all stacks) const resourceGroup = new azure.core.ResourceGroup("k8s-az"); // Grant the resource group the "Network Contributor" role so that it // can link the static IP to a Service LoadBalancer. const rgNetworkRole = new azure.role.Assignment(
${name}-spRole
, { principalId: principalClient.id, scope: resourceGroup.id, roleDefinitionName: "Network Contributor", }); const clientConfig = azure.core.getClientConfig(); const currentPrincipal = clientConfig.objectId; const admins = new azuread.Group("admins", { name: "pulumi:admins", members: [ currentPrincipal, ], }); /* Create a new user in AD. const dev = new azuread.User("k8s-dev", { userPrincipalName: "k8sdev@example.com", displayName: "Kubernetes Dev", password: "Qjker21!G", }); */ const dev = azuread.getUser({ userPrincipalName: "alice@example.com", }); const devs = new azuread.Group("devs", { name: "pulumi:devs", members: [ // Assign a new or existing user to the group. dev.objectId, ], }); // Export outputs for other stacks export const resourceGroupName = resourceGroup.name; export const adServerAppId = applicationServer.applicationId; export const adServerAppSecret = spPasswordServer.value; export const adClientAppId = applicationClient.applicationId; export const adClientAppSecret = spPasswordClient.value; export const adGroupAdmins = admins.objectId; export const adGroupDevs = devs.objectId;`
b
@colossal-school-15171might be easier if you post it in a github gist
c
right, sorry. a bit distracted. hang on.
It's literally just this: https://github.com/pulumi/kubernetes-guides/blob/master/azure/01-identity/index.ts no changed to the code, no special sauce, following all the instructions, and I get these obscure errors that I can't even find mentioned anywhere online.