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

Privileges datasource #82

Merged
merged 10 commits into from
Jun 16, 2021
Merged

Privileges datasource #82

merged 10 commits into from
Jun 16, 2021

Conversation

appilon
Copy link
Contributor

@appilon appilon commented Jun 16, 2021

Datasource that exports list of privileges. See examples for how to use terraform for as well as dynamic to filter the list, and generate privileges blocks in role resources.

This PR also enables ORG_UNIT scoped role_assignment, however the practitioner must ensure only is_org_unit_scopable privileges are passed along.

Odd discovery, the Google API returns org_unit ids with a id: prefix, somehow this isn't an issue for the org unit resource/datasource itself, however I had to strip that prefix when passing it the role_assignment resource. Perhaps the org_unit resource should strip that itself? It feels like a mistake on the API end to have that prefix.

Closes #72

@appilon appilon requested a review from megan07 June 16, 2021 00:50
@appilon appilon added this to the 0.2.0 milestone Jun 16, 2021
Copy link
Contributor

@megan07 megan07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! thanks!

@@ -71,6 +72,14 @@ resource "googleworkspace_group_settings" "sales-settings" {
- **id** (String) The ID of this resource.
- **name** (String) Name of the group, which has a maximum size of 75 characters.

<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh thanks :)

duplicates[id] = true
}
if len(priv.ChildPrivileges) > 0 {
result = append(result, flattenAndPrunePrivileges(priv.ChildPrivileges, duplicates)...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you found that there would be a parent duplicated in a child? I'm wondering if we need to be concerned about passing duplicates around?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure, but this solution should be robust

### Read-Only

- **etag** (String) ETag of the resource.
- **items** (List of Object) A list of Privilege resources. (see [below for nested schema](#nestedatt--items))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to mention somewhere that this will be a flattened list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

@appilon appilon merged commit 8d0ea49 into main Jun 16, 2021
@appilon appilon deleted the alex-d/privileges branch June 16, 2021 19:44
@appilon appilon mentioned this pull request Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Privileges DataSource
2 participants