From dee24fae53f0506458e7f0591ccac58338d59852 Mon Sep 17 00:00:00 2001 From: hkavya26 Date: Mon, 29 Apr 2024 20:07:59 +0530 Subject: [PATCH] fix access group members resource: recreate ag members when it is deleted outside terraform --- .../iamaccessgroup/resource_ibm_iam_access_group_members.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_members.go b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_members.go index 76b36a3bad..650e86424a 100644 --- a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_members.go +++ b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_members.go @@ -164,6 +164,10 @@ func resourceIBMIAMAccessGroupMembersRead(context context.Context, d *schema.Res listAccessGroupMembersOptions.SetLimit(limit) members, detailedResponse, err := iamAccessGroupsClient.ListAccessGroupMembers(listAccessGroupMembersOptions) if err != nil { + if detailedResponse != nil && detailedResponse.StatusCode == 404 { + d.SetId("") + return nil + } return diag.FromErr(fmt.Errorf("[ERROR] Error retrieving access group members: %s. API Response: %s", err, detailedResponse)) } allMembers := members.Members