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

ENG-8938: Add data source to retrieve user groups #264

Merged
merged 7 commits into from
Aug 6, 2022
Merged

Conversation

Yowgf
Copy link
Contributor

@Yowgf Yowgf commented Aug 5, 2022

Description of the change

Adds data source cyral_role. cyral_role can be used to retrieve roles that exist in the Cyral Control Plane. See Testing section below for an example of how to use the data source.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • Jira issue referenced in commit message and/or PR title

Testing

The ACC tests added ensure that at least the data source can be deployed without generating errors. I didn't complete the full scenario for the ACC tests due to time constraints for this release, but added a TODO.

Manually tested with following config, and checked in local file that the contents are as expected.

data "cyral_role" "admin_roles" {
    name = "^.*Admin$"
}

resource "local_file" "admin_roles" {
  content = jsonencode(data.cyral_role.admin_roles.role_list)
  filename = "roles.json"
}

Also, if the name filter is an invalid regexp, we get a nice error message:

╷
│ Error: Unable to read resource
│ 
│   with data.cyral_role.admin_roles,
│   on test.tf line 1, in data "cyral_role" "admin_roles":
│    1: data "cyral_role" "admin_roles" {
│ 
│ provided name filter is invalid regexp: error parsing regexp: missing closing ]: `[.*Admin$`

@Yowgf Yowgf marked this pull request as ready for review August 6, 2022 01:13
@Yowgf Yowgf requested a review from wcmjunior August 6, 2022 01:13
@wcmjunior wcmjunior merged commit 11073ef into main Aug 6, 2022
@wcmjunior wcmjunior deleted the feature/ENG-8938 branch August 6, 2022 05:42
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.

2 participants