[SOLVED] I solved the above issue mostly, but I'm ...
# automation-api
v
[SOLVED] I solved the above issue mostly, but I'm still having an issue that doing a stack preview/up only resolves 1 resource (the stack itself):
Copy code
+  pulumi:pulumi:Stack template-shooter-dev create 
Outputs:
    k8sIds: [
        [0]: "Local Deployment"
    ]

Resources:
    + 1 to create
I've narrowed this down to a working environment issue. I can create a separate project with the automation api script and I see the docker remoteimage resource show up in the preview. I have ensured that both repos have the same npm pulumi versions, have the same tsconfig.json, and even tried using this script in the original repo (where it fails to show the docker resource)
Copy code
import { InlineProgramArgs, LocalWorkspace } from "@pulumi/pulumi/automation";

import * as docker from "@pulumi/docker";

const run = async () => {
  // This is our pulumi program in "inline function" form
  const pulumiProgram = async () => {
    const ubuntu = new docker.RemoteImage("ubuntu", { name: "ubuntu:precise" });

    return {
      hello: "world2",
      // tagUrn: tag.urn,
    };
  };

  // Create our stack
  const args: InlineProgramArgs = {
    stackName: "dev",
    projectName: "pulumi-auto",
    program: pulumiProgram
  };

  // create (or select if one already exists) a stack that uses our inline program
  const stack = await LocalWorkspace.createOrSelectStack(args, {
    envVars: { PULUMI_CONFIG_PASSPHRASE: "" }
  });

  await stack.preview({
    onOutput: (out) => console.log(out)
  });
};

run();
I've wiped build outputs (ts lib/dist folders, tsconfig.tsbuildinfo) and node_modules, and regenerating as needed (TS isn't transpiled ahead of time for either project; the same version of
ts-node
is used for both (
10.9.2
) I've tried running both scripts from both vscode project terminals to make sure some lingering environment variables aren't affecting things
my original repo uses yarn workspaces but the new test one didn't, so I tried mimicking the workspace setup, but the new one still shows the docker resource 😞
this issues seems to be caused due to my
@pulumi/<other>
packages having their dependencies
"@pulumi/pulumi@^3.0.0", "@pulumi/pulumi@^3.25.0":
resolve to the first version of
@pulumi/pulumi
that I installed (
3.112.0
) and when I upgraded
@pulumi/pulumi
direct dependency, it added an additional dependency
3.118.0
, so two different modules were being referenced (one in
node_modules/@pulumi/pulumi
and the other in
packages/deployment/node_modules/@pulumi/pulumi
), causing issues with the AsyncLocalStorage being synced. the solution was to consolidate the
@pulumi/pulumi
dependency in my
yarn.lock
file, and that it seems to be a bug with older versions of yarn (which I'm using still): https://github.com/yarnpkg/yarn/issues/8068