Add a custom resource for Key Vault access policies#2951
Merged
Conversation
Contributor
Does the PR have any schema changes?Looking good! No breaking changes found. New resources:
|
d2b2418 to
10f5d17
Compare
1128719 to
5258b14
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2951 +/- ##
==========================================
- Coverage 60.52% 60.09% -0.43%
==========================================
Files 64 65 +1
Lines 10588 10852 +264
==========================================
+ Hits 6408 6522 +114
- Misses 3640 3785 +145
- Partials 540 545 +5 ☔ View full report in Codecov by Sentry. |
7ba7c8f to
b25f186
Compare
b25f186 to
05bb6d9
Compare
danielrbradley
approved these changes
Jan 2, 2024
danielrbradley
left a comment
Contributor
There was a problem hiding this comment.
Core implementation and integration tests all look good to go 👍
I think there's opportunity to add some basic unit tests around the simple funcitons like parseKeyVaultPathParams, sdkPolicyToMap, sdkPermissionsToMap and propertyPermissionsToSdk but happy for this to ship with the core integration tests for now if preferred.
6df5cf7 to
7fad6f6
Compare
…nd a recursive traversal to populate it
… and make it mockable
Use require in tests and clarify comment
…ts to serialize their creation.
11d42f4 to
a39df13
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements #594, allowing access policies (APs) to be managed as individual Pulumi resources.
This PR builds on top of #2950 and shares its commits.
It adds a new custom resource following the design of the existing ones: use Azure's KeyVault client to directly implement the AP CRUD operations. Note that access policies do not have standard CRUD semantics. Instead, the "add" operation merges if the AP already exists, and the "replace" operation creates if it does not exist. Therefore, the custom resource uses "replace" for both create and update, with a prior read to ensure that the AP does/does not exist yet.
In addition to the custom resource, some other changes were required:
azcoreinterfaces. Our existing tokens are valid, so I added a wrapper to implement the azcore interface.Vaultrequires theaccessPoliciesproperty, but we don't want to explicitly set it to an empty[]and record this in Pulumi state. Otherwise, every update to the vault would clear out the APs.