-
Notifications
You must be signed in to change notification settings - Fork 38
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
Custom resource for Azure PIM role management policies #3663
base: master
Are you sure you want to change the base?
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. New resources:
New functions:
|
e75e3f2
to
5c2b57a
Compare
5c2b57a
to
5cba82d
Compare
Looks reasonable, except that the Delete operation in the spec isn't actually implemented. Sigh.
…rnal validation via azure SDK
…oesn't know about path properties
df899b5
to
38feaba
Compare
if customRes.CanCreate != nil { | ||
err = customRes.CanCreate(ctx, id) | ||
exists = err != nil | ||
} else if customRes.Read != nil { | ||
_, exists, err = customRes.Read(ctx, id, inputs) | ||
} else { | ||
err = crudClient.CanCreate(ctx, id) | ||
exists = err != nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems we were previously assuming all custom resources have Read
but now we're guarding in case it's nil? If it's nil (the resource doesn't override Read), should be be using the default Read implementation instead (like any other resource derived from the specs)?
About
This PR adds support for Role Management Policies, part of Privileged Identity Management (PIM) in the Microsoft.Authentication namespace. It's one part of #2455.
Note that this is about the ARM part of PIM; there's also a Microsoft Graph API part which is not covered by this provider.
This resource wasn't automatically included because it supports only GET and PATCH. The policies are singletons that cannot be created or deleted, only modified via PATCH.
Implementation
Role Management Policies essentially consist of a name which is actually a GUID, and a list of ~20 rules.
Using our existing singleton support
defaults.GetDefaultResourceState
was tricky becauseSo instead, I've implemented a custom resource that captures the original state of a policy when it's first "created", i.e., added to Pulumi state. When a rule or the whole policy is removed from Pulumi, we look up the original state and re-apply it.
Testing
The e2e/integration test for this resource is special because using PIM requires a paid Entra ID P2 license. We have one that you can see here.