Supports --include-role-assignment in res mode#633
Merged
magodo merged 2 commits intoAzure:mainfrom Jul 10, 2025
Merged
Conversation
magodo
requested changes
Jul 10, 2025
Collaborator
magodo
left a comment
There was a problem hiding this comment.
Thanks for this PR!
I've taken a look through and left some comments inline, but this is mostly looking good to me 👍
internal/meta/meta_res.go
Outdated
Comment on lines
+167
to
+170
| var ids []string | ||
| for _, res := range resources { | ||
| ids = append(ids, res.Id.String()) | ||
| } |
Collaborator
There was a problem hiding this comment.
Can we combine this loop with the one at L185, and put it right above where it was used (L188)?
internal/meta/meta_res.go
Outdated
|
|
||
| rset := &resourceset.AzureResourceSet{ | ||
| Resources: resources, | ||
| rset, err := meta.queryResourceSet(ctx, resources) |
Collaborator
There was a problem hiding this comment.
This is only necessary if includeRoleAssignment = true, otherwise, we don't need to call azlist, to save one or more APIs.
| @@ -0,0 +1,163 @@ | |||
| package meta | |||
- renamed meta_res_test.go - meta_res.go: remove redundant loop - meta_res.go: avoid querying azlist if role assignment not included
magodo
approved these changes
Jul 10, 2025
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.
Adds a new parameter --include-role-assignment in res mode to include resource scope RBAC role assignments.
Example usage:
Following cases are tested manually:
aztfexport reswith and without--include-role-assignmentover 1 and multiple resourcesaztfexport rgwith--include-role-assignment