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

Creating Accounts With LDAP #915

Closed
max1c opened this issue May 12, 2023 · 2 comments
Closed

Creating Accounts With LDAP #915

max1c opened this issue May 12, 2023 · 2 comments
Labels

Comments

@max1c
Copy link

max1c commented May 12, 2023

Terraform Version

  • Terraform: 1.4.6
  • Terraform Grafana Provider: 1.39
  • Grafana: 9.3

Expected Behavior

This is more of a general question for clarification rather than a bug report. We have a Grafana instance (hosted on prem) that plugs into LDAP. We have created teams using 'grafana_team' and want to add all of the users to appropriate teams. Since the users can only be added to the teams once the accounts are created in Grafana we want to create all users from our list (around 200). However, the 'grafana_users' only allows to use basic auth when creating the accounts. I have also checked Ansible module and it looks like it also only supports basic auth. Is there a way to create accounts in Grafana which would then be connected and logged-in via LDAP? If not, is there a workaround for this?

@max1c max1c added the bug label May 12, 2023
@max1c
Copy link
Author

max1c commented May 23, 2023

I found this as a reference: #725
Now I am trying to do the following: query LDAP for the list of users and query the Grafana for the list of users. Then use setintersection() to match two lists. Here is the code I am using:

resource "grafana_team" "teams" {
  for_each = local.test.teams
  members  = setintersection(toset(data.ldap_group.group[each.key].members_names), [for user in data.grafana_users.all_users.users : user.login])
}

The terraform plan passes as expected. It correctly outputs the usernames that exist in Grafana interface. However, terraform apply fails with "Error: error adding user username. User does not exist in Grafana". This seems to be an issue for all users even though they clearly exist in the interface. I've also tried by creating users locally (no LDAP) and the same error occurs. @julienduchesne Can you please help with this?

@max1c
Copy link
Author

max1c commented May 23, 2023

Okay, it looks like it has to be an email and cannot be a user.name.

@max1c max1c closed this as completed May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant