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

[BUG] Inconsistency of resources for roles and data sources #23

Closed
1 task done
lechnerc77 opened this issue Oct 15, 2024 · 2 comments · Fixed by #29
Closed
1 task done

[BUG] Inconsistency of resources for roles and data sources #23

lechnerc77 opened this issue Oct 15, 2024 · 2 comments · Fixed by #29
Labels
bug Something isn't working

Comments

@lechnerc77
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What version of the Terraform provider are you using?

1.0.0-rc1

What version of the Terraform CLI are you using?

1.9.5

What CF API version are you using?

3.137

What type of issue are you facing

bug report

Describe the bug

The resources and data sources to assign and read roles of users are not consistent. While the resources distinguish the levels of organization and space (org_role, space_role), the data source is a single one for all levels (role).

Expected Behavior

Data sources for the org and space level are available in analogy to the resources

Steps To Reproduce

n/a

Your Terraform Configuration

n/a

Roles

n/a

Add screenshots to help explain your problem

n/a

Additional context

n/a

@lechnerc77 lechnerc77 added the bug Something isn't working label Oct 15, 2024
@vipinvkmenon
Copy link
Contributor

The resources org_role and space_role were created as a convenience for the end user. The underlying API for both is roles API. From the API definition, it does not really distinguish between a space-role and an org-role. It only needs to role-guid to get the details. So even if we create 2 datasources for space_role and org_role it would be the same call and the same structure inside.

We could maybe validate whether the given role-GUID is a valid space-role or org-role depending on the type of data source 🤔

@lechnerc77
Copy link
Contributor Author

@vipinvkmenon I think you can follow the same approach as for the resource:
For the data source for org roles the interface only supports an org_id, while for space roles org_id and space_id are mandatory parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants