Skip to content

Commit

Permalink
validate errors while setting resource data
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow649 committed Jul 28, 2023
1 parent 37a89dc commit c6e371d
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions sysdig/data_source_sysdig_custom_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,25 @@ func dataSourceSysdigCustomRoleRead(ctx context.Context, d *schema.ResourceData,
}

d.SetId(strconv.Itoa(customRole.ID))
_ = d.Set(SchemaNameKey, customRole.Name)
_ = d.Set(SchemaDescriptionKey, customRole.Description)
_ = d.Set(SchemaMonitorPermKey, customRole.MonitorPermissions)
_ = d.Set(SchemaSecurePermKey, customRole.SecurePermissions)
err = d.Set(SchemaNameKey, customRole.Name)
if err != nil {
return diag.FromErr(err)
}

err = d.Set(SchemaDescriptionKey, customRole.Description)
if err != nil {
return diag.FromErr(err)
}

err = d.Set(SchemaMonitorPermKey, customRole.MonitorPermissions)
if err != nil {
return diag.FromErr(err)
}

err = d.Set(SchemaSecurePermKey, customRole.SecurePermissions)
if err != nil {
return diag.FromErr(err)
}

return nil
}

0 comments on commit c6e371d

Please sign in to comment.