From 6ab7898874326ffc38359d47b6683e182feecc98 Mon Sep 17 00:00:00 2001 From: zl0ty Date: Tue, 22 Oct 2024 14:33:27 +0200 Subject: [PATCH] switch from group name to group id --- cloudconnexa/data_source_user_group.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cloudconnexa/data_source_user_group.go b/cloudconnexa/data_source_user_group.go index f4849c8..ce025e9 100644 --- a/cloudconnexa/data_source_user_group.go +++ b/cloudconnexa/data_source_user_group.go @@ -15,12 +15,12 @@ func dataSourceUserGroup() *schema.Resource { Schema: map[string]*schema.Schema{ "id": { Type: schema.TypeString, - Computed: true, + Required: true, Description: "The user group ID.", }, "name": { Type: schema.TypeString, - Required: true, + Computed: true, Description: "The user group name.", }, "vpn_region_ids": { @@ -66,13 +66,13 @@ func dataSourceUserGroup() *schema.Resource { func dataSourceUserGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { c := m.(*cloudconnexa.Client) var diags diag.Diagnostics - userGroupName := d.Get("name").(string) - userGroup, err := c.UserGroups.GetByName(userGroupName) + userGroupId := d.Get("id").(string) + userGroup, err := c.UserGroups.Get(userGroupId) if err != nil { return append(diags, diag.FromErr(err)...) } if userGroup == nil { - return append(diags, diag.Errorf("User group with name %s was not found", userGroupName)...) + return append(diags, diag.Errorf("User group with id %s was not found", userGroupId)...) } d.SetId(userGroup.ID) d.Set("name", userGroup.Name)