Skip to content

Commit

Permalink
fix(identity) Trusted profile history field error (IBM-Cloud#6031)
Browse files Browse the repository at this point in the history
  • Loading branch information
Somchavan authored Mar 5, 2025
1 parent 5038560 commit df98f01
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ibm/service/iamidentity/resource_ibm_iam_trusted_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,20 @@ func resourceIBMIamTrustedProfileRead(context context.Context, d *schema.Resourc
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_iam_trusted_profile", "read", "set-ims_user_id").GetDiag()
}
}
history := []map[string]interface{}{}
if !core.IsNil(trustedProfile.History) {
history := []map[string]interface{}{}
for _, historyItem := range trustedProfile.History {
historyItemMap, err := ResourceIBMIamTrustedProfileEnityHistoryRecordToMap(&historyItem) // #nosec G601
if err != nil {
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_iam_trusted_profile", "read", "history-to-map").GetDiag()
}
history = append(history, historyItemMap)
}
if err = d.Set("history", history); err != nil {
err = fmt.Errorf("Error setting history: %s", err)
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_iam_trusted_profile", "read", "set-history").GetDiag()
}
}
if err = d.Set("history", history); err != nil {
err = fmt.Errorf("Error setting history: %s", err)
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_iam_trusted_profile", "read", "set-history").GetDiag()

}

return nil
Expand Down

0 comments on commit df98f01

Please sign in to comment.