-
Notifications
You must be signed in to change notification settings - Fork 214
Supports --include-role-assignment in res mode #633
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
Supports --include-role-assignment in res mode #633
Conversation
magodo
left a comment
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.
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
| var ids []string | ||
| for _, res := range resources { | ||
| ids = append(ids, res.Id.String()) | ||
| } |
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.
Can we combine this loop with the one at L185, and put it right above where it was used (L188)?
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.
Fixed
internal/meta/meta_res.go
Outdated
|
|
||
| rset := &resourceset.AzureResourceSet{ | ||
| Resources: resources, | ||
| rset, err := meta.queryResourceSet(ctx, resources) |
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.
This is only necessary if includeRoleAssignment = true, otherwise, we don't need to call azlist, to save one or more APIs.
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.
Fixed
| @@ -0,0 +1,163 @@ | |||
| package meta | |||
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.
Typo in the file name.
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.
Fixed
- renamed meta_res_test.go - meta_res.go: remove redundant loop - meta_res.go: avoid querying azlist if role assignment not included
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