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]: codefresh_current_account data source returns 403 #131

Closed
dave23122 opened this issue Dec 8, 2023 · 0 comments · Fixed by #143
Closed

[Bug]: codefresh_current_account data source returns 403 #131

dave23122 opened this issue Dec 8, 2023 · 0 comments · Fixed by #143
Assignees
Labels
bug Something isn't working

Comments

@dave23122
Copy link

dave23122 commented Dec 8, 2023

What happened?

When trying to use the codefresh_current_account data source with any provider version above 0.1.2 (0.1.2 works), a 403 error is returned:

{"status":403,"code":"2400","name":"FORBIDDEN_ERROR","message":"Required role: 'Admin' is not included in the user
roles: [User]","context":{"requiredRole":"Admin","userRoles":["User"]}}

I am using a token that is an account admin, so would expect to be able to use this. However am unsure if this data source is intended to only be able to be used by a token that is a Codefresh level admin, rather than just an account admin.

Version

0.2.0+

Relevant Terraform Configuration

terraform {
  required_providers {
    codefresh = {
      source = "codefresh-io/codefresh"
      version = "0.6.0"
    }
  }
}

data "codefresh_current_account" "acc" {

}
@dave23122 dave23122 added the bug Something isn't working label Dec 8, 2023
@korenyoni korenyoni self-assigned this Dec 26, 2023
ilia-medvedev-codefresh added a commit that referenced this issue Mar 26, 2024
## What
Remove unnecessary call to GetUserByID that requires admin token to get
the account admins info. Instead infer admin info from /user endpoint
which returns the info for all users. As admins are also users the data
is there, it is enough to just locate the admins in this existing list.
## Why
Closes #131 
## Notes
<!-- Add any notes here -->

## Checklist

* [ ] _I have read
[CONTRIBUTING.md](https://github.com/codefresh-io/terraform-provider-codefresh/blob/master/CONTRIBUTING.md)._
* [ ] _I have [allowed changes to my fork to be
made](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)._
* [ ] _I have added tests, assuming new tests are warranted_.
* [ ] _I understand that the `/test` comment will be ignored by the CI
trigger [unless it is made by a repo admin or
collaborator](https://codefresh.io/docs/docs/pipelines/triggers/git-triggers/#support-for-building-pull-requests-from-forks)._
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
Development

Successfully merging a pull request may close this issue.

3 participants