From 75539ba77d971550c9957dae11adcba21ad1b94b Mon Sep 17 00:00:00 2001 From: zl0ty Date: Mon, 4 Nov 2024 17:31:48 +0100 Subject: [PATCH] change assignment --- cloudconnexa/data_source_user_group.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cloudconnexa/data_source_user_group.go b/cloudconnexa/data_source_user_group.go index 26ce103..1d3c4c0 100644 --- a/cloudconnexa/data_source_user_group.go +++ b/cloudconnexa/data_source_user_group.go @@ -67,11 +67,12 @@ func dataSourceUserGroup() *schema.Resource { func dataSourceUserGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { c := m.(*cloudconnexa.Client) var diags diag.Diagnostics - var userGroup cloudconnexa.UserGroup + var userGroup *cloudconnexa.UserGroup + var err error userGroupId := d.Get("id").(string) userGroupName := d.Get("name").(string) if userGroupId != "" { - userGroup, err := c.UserGroups.Get(userGroupId) + userGroup, err = c.UserGroups.Get(userGroupId) if err != nil { return append(diags, diag.FromErr(err)...) } @@ -79,7 +80,7 @@ func dataSourceUserGroupRead(ctx context.Context, d *schema.ResourceData, m inte return append(diags, diag.Errorf("User group with id %s was not found", userGroupId)...) } } else if userGroupName != "" { - userGroup, err := c.UserGroups.GetByName(userGroupName) + userGroup, err = c.UserGroups.GetByName(userGroupName) if err != nil { return append(diags, diag.FromErr(err)...) }