https://pulumi.com logo
#general
Title
# general
m

most-napkin-55076

12/04/2023, 11:48 AM
Does anyone know why I'm getting the following error on Mac, connecting to Pulumi Cloud?
Copy code
policy pack <path-to-folder-containing-PulumiPolicy.yaml> failed to start: could not read plugin [/opt/homebrew/bin/pulumi-analyzer-policy] stdout: EOF
Maybe it's what we're trying to do that off, but we're trying to make a central policy pack with the following
index.ts
, which is going to published in an npm packages
Copy code
import { Guard } from './guard';

import './policy-groups/<custom policy>';
... repeating more policies

export { Guard };
And then in the specific use-case we'll do the following (this is importing from local, but I suspect this shouldn't matter
Copy code
import { Guard } from '.';

export default new Guard('policy-pack', { all: 'mandatory' });
And then applying it to the Pulumi stack.preview() method as follows
Copy code
await stack.preview({
    onOutput: (message: string): void => {
      process.stdout.write(message);
    },
    diff: options.diff,
    policyPacks: [
      path.join(
        context.root,
        context.workspace.projects['pulumi-policy-pack'].root
      ),
    ],
    ...
})
I'm not sure if this way of importing/exporting a policy guard would actually work as we expect, but the error message is pretty much useless so really unable to properly troubleshoot it. We're largely taking inspiration from this repository: https://github.com/pulumi/pulumi-policy-aws/blob/master/src/index.ts