Skip to content

Commit

Permalink
Set service account role to "None" if no role is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
F21 committed Apr 3, 2024
1 parent 8322f22 commit 5a1ce44
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions path_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,14 @@ func createCloudAccessPolicyToken(c *client.Grafana, credentialName string, role
}

func createCloudServiceAccountToken(c *client.Grafana, credentialName string, roleEntry *grafanaRoleEntry) (*grafanaToken, error) {
role := "None"
if roleEntry.Role != "" {
role = roleEntry.Role
}

serviceAccount, err := c.CreateGrafanaServiceAccountFromCloud(roleEntry.Stack, client.CreateServiceAccountInput{
Name: credentialName,
Role: roleEntry.Role,
Role: role,
})

if err != nil {
Expand Down Expand Up @@ -197,9 +202,14 @@ func createCloudServiceAccountToken(c *client.Grafana, credentialName string, ro
}

func createServiceAccountToken(c *client.Grafana, credentialName string, roleEntry *grafanaRoleEntry) (*grafanaToken, error) {
role := "None"
if roleEntry.Role != "" {
role = roleEntry.Role
}

serviceAccount, err := c.CreateServiceAccount(client.CreateServiceAccountInput{
Name: credentialName,
Role: roleEntry.Role,
Role: role,
})

if err != nil {
Expand Down

0 comments on commit 5a1ce44

Please sign in to comment.