Is it possible to have multiple policy packs in sa...
# aws
a
Is it possible to have multiple policy packs in same project? Currently it seems only one is supported per project/folder. I prefer to use several small packs without overhead of creating new project with node_modules, etc... for few lines of code in each
g
You can have multiple packs per project but you will need each pack in its own folder I believe.
a
will try that, thanks
g
A single pack can be pulled together from multiple files too - which is how AWSGuard does it. https://github.com/pulumi/pulumi-policy-aws/blob/master/src/index.ts
a
when I put it in folders I get "could not read plugin [\.pulumi\bin\pulumi-analyzer-policy.cmd] stdout: EOF"
g
How are you executing it?
a
I extended PolicyPack class
so instead I need to create policypack dynamically in index.ts I guess and use other files like factories that create policies
something like this may work. Then I will have small factory functions and call new PolicyPackBuilder("MyAwsPack") .withPolicy(dynamoDbFactory) .withPolicy(s3Factory) .build("mandatory")
I went with inheritance initially because AwsGuard is implemented this way
I think it would make sense to support either nesting similar to ComponentResource or grouping with some container class for policy packs