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

is_admin added to grafana_user. #157

Merged
merged 1 commit into from
Jan 29, 2021
Merged

Conversation

AlirezaKm
Copy link

@AlirezaKm AlirezaKm commented Jan 22, 2021

What

Added 1 new field (is_admin) to grafana_user to create grafana admin user.

Why ?

Create admin user in the default organization.

Verification

  • make testacc passed.
  • Tests in Grafana 7.3.6.

Copy link
Member

@trotttrotttrott trotttrotttrott left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@trotttrotttrott trotttrotttrott merged commit 7ab97a4 into grafana:master Jan 29, 2021
@caoimheharvey
Copy link

caoimheharvey commented Mar 3, 2023

Hi, I'm having issues when using this, I'm able to create the user, but when is_admin is set to true it seems to still create it as a Viewer. I'm not able to spot anything useful in the debug logs during the terraform apply to help explain this.
I tried also manually updating the test user to Admin then setting is_admin to false for the user that was created and it also didn't revert the permissions on the Grafana dashboard to Viewer.
I'm looking at the User struct here and it looks like by default the isAdmin is omitted if not provided explicitly.
https://github.com/grafana/grafana-api-golang-client/blob/master/user.go#L20
My grasp on GoLang is a bit iffy so perhaps I'm looking at the wrong thing, but any help would be appreciated.
93dbbf4#diff-bb873edc41663d158ebb4afe9130d1840ff2575b76f90d21eee7498c1c2a2ab4R55

user := gapi.User{
		Email:    d.Get("email").(string),
		Name:     d.Get("name").(string),
		Login:    d.Get("login").(string),
		Password: d.Get("password").(string),
	}

As far as I can tell, the code in the PR seems to update the resource in the Terraform state but I'm not seeing where its updating on the Grafana instance itself, maybe I'm not looking in the right place.
I can raise a PR to resolve this if this is in fact the issue :)

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.

3 participants