Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Python support for writing rules #98

Closed
5 tasks
joeduffy opened this issue Aug 30, 2019 · 2 comments
Closed
5 tasks

Implement Python support for writing rules #98

joeduffy opened this issue Aug 30, 2019 · 2 comments
Assignees
Labels
feature/pac Impacts the Policy as Code offering size/L Estimated effort to complete (up to 10 days).
Milestone

Comments

@joeduffy
Copy link
Member

joeduffy commented Aug 30, 2019

Meta issue tracking the following work:

@ekrengel ekrengel added the feature/pac Impacts the Policy as Code offering label Oct 7, 2019
@joeduffy joeduffy assigned justinvp and unassigned justinvp Nov 23, 2019
@joeduffy
Copy link
Member Author

I am only now realizing policy plugins don't work the way I had thought.

Instead of having a plugin per policy pack, we have a single universal plugin, pulumi-analyzer-policy, which loads Node.js program that dynamically loads the desired policy pack.

This seems like it will fundamentally make it difficult to ever support more than just Node.js.

The alternative, which I assumed we were doing, was to use the plugin system to distribute, install, and manage policy packs, and to use the ability to have many versions side-by-side. That would get us multi-language while also aligning with how the rest of the system works.

And yet that's a fairly fundamental change. @justinvp Have you thought much about this? Do you have an alternative in mind that is simpler to get to from where we are?

I hit this because I need to write a policy pack in Go.

@joeduffy joeduffy assigned justinvp and unassigned hausdorff Nov 23, 2019
joeduffy added a commit to pulumi/pulumi that referenced this issue Nov 28, 2019
The current policy plugin system assumes that the target plugin
uses our opinionated Node.js loader shim to set up the plugin. This
makes it impossible to leverage plugins written in other languages
(like [Python](pulumi/pulumi-policy#98) or, in my case, Go).

It turns out this shim isn't entirely required. It's actually just
there for convenience, as it hides the boilerplate of implementing
the gRPC analyzer server necessary to communicate with the engine.
If you've implemented said interface by hand, or via some alternative
mechanism, there's no reason we can't just load the plugin like we
do with other plugins -- languages, resource providers, etc.

This change is arguably a bit of a hack. It looks at the target
--policy-pack and, if it's a directory, keeps the old behavior of
using the Node.js shim. If it's a file, on the other hand, it assumes
that file is the plugin binary and loads it directly. I'm not actually
suggesting this is the right way to do it. But it does unblock the
project I'm currently tinkering with.

This also calls into question what approach we'd actually want to
take with service-managed policy packs.

Either way, we will need to figure out what approach to take that
supports authoring policy packs in different languages.
@ekrengel ekrengel added the pac/ga label Jan 8, 2020
@ekrengel ekrengel added this to the 0.32 milestone Jan 8, 2020
@ekrengel ekrengel added the size/L Estimated effort to complete (up to 10 days). label Jan 15, 2020
@ekrengel ekrengel modified the milestones: 0.32, 0.33 Feb 6, 2020
@justinvp
Copy link
Member

I'm going to close this meta-issue since we have smaller issues tracking the reamining work to do here (linked in the description).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/pac Impacts the Policy as Code offering size/L Estimated effort to complete (up to 10 days).
Projects
None yet
Development

No branches or pull requests

4 participants