Skip to content

Commit

Permalink
SM Installation: Export credentials (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienduchesne authored May 9, 2023
1 parent d266e2a commit e91e09d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/grafana/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,24 @@ func Configure(p *ujconfig.Provider) {
}
delete(r.TerraformResource.Schema, "logs_instance_id") // Deprecated
delete(r.TerraformResource.Schema, "metrics_instance_id") // Deprecated

r.Sensitive.AdditionalConnectionDetailsFn = func(attr map[string]interface{}) (map[string][]byte, error) {
conn := map[string][]byte{}

providerConfig := map[string]string{}
if a, ok := attr["sm_access_token"].(string); ok {
providerConfig["sm_access_token"] = a
}
if a, ok := attr["stack_sm_api_url"].(string); ok {
providerConfig["sm_url"] = a
}
marshalled, err := json.Marshal(providerConfig)
if err != nil {
return nil, err
}
conn["smCredentials"] = marshalled

return conn, nil
}
})
}

0 comments on commit e91e09d

Please sign in to comment.