Closed bhayes-zd closed 3 years ago
I think the bigger Problem here is that the sharing parameter is hard-coded:
func splunkDashboardsCreate(d *schema.ResourceData, meta interface{}) error {
provider := meta.(*SplunkProvider)
name := d.Get("name").(string)
splunkDashboardsObj := getSplunkDashboardsConfig(d)
aclObject := &models.ACLObject{}
if r, ok := d.GetOk("acl"); ok {
aclObject = getACLConfig(r.([]interface{}))
} else {
aclObject.App = "search"
aclObject.Owner = "admin"
aclObject.Sharing = "user"
}
err := (*provider.Client).CreateDashboardObject(aclObject.Owner, aclObject.App, splunkDashboardsObj)
if err != nil {
return err
}
if _, ok := d.GetOk("acl"); ok {
aclObject.Sharing = "user" // hard-coding to avoid to user input; because changing object sharing permissions messes deletion of object
err = (*provider.Client).UpdateAcl(aclObject.Owner, aclObject.App, name, aclObject, "data", "ui", "views")
if err != nil {
return err
}
}
d.SetId(name)
return splunkDashboardsRead(d, meta)
}
@bhayes-zd @ftieben We thought there might be an issue there. I have a branch with the fix and will merge when tests are done.
Problem
When attempting to create a dashboard using the
splunk_data_ui_views
the permissions settings always revert to private. So when attempting to post the following, it does not maintain theglobal
permission.This same issue occurs when attempting to set any level of access other than
private
.Potential problem spots are the following:
Expected Behavior
When running
terraform apply
, it should create the dashboard with the same permissions as the HCL config.This might be worth adding as a unit test. Let me know if I can help in any way ! 😄