Skip to content

Commit f186da7

Browse files
csanxCristina Sánchez Sánchez
andauthored
chore: Update data sources to use List type for users attribute (#3495)
* Changed attribute `users` from Set to List type + attribute `roles` in project to be a Set * Trigger checks --------- Co-authored-by: Cristina Sánchez Sánchez <[email protected]>
1 parent 8d8fdcb commit f186da7

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

internal/common/dsschema/users_schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
func DSOrgUsersSchema() *schema.Schema {
88
return &schema.Schema{
9-
Type: schema.TypeSet,
9+
Type: schema.TypeList,
1010
Computed: true,
1111
Elem: &schema.Resource{
1212
Schema: map[string]*schema.Schema{

internal/service/project/model_project.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
1717
)
1818

19-
func UsersProjectSchema() schema.SetNestedAttribute {
20-
return schema.SetNestedAttribute{
19+
func UsersProjectSchema() schema.ListNestedAttribute {
20+
return schema.ListNestedAttribute{
2121
Computed: true,
2222
NestedObject: schema.NestedAttributeObject{
2323
Attributes: map[string]schema.Attribute{
@@ -27,7 +27,7 @@ func UsersProjectSchema() schema.SetNestedAttribute {
2727
"org_membership_status": schema.StringAttribute{
2828
Computed: true,
2929
},
30-
"roles": schema.ListAttribute{
30+
"roles": schema.SetAttribute{
3131
Computed: true,
3232
ElementType: types.StringType,
3333
},
@@ -138,7 +138,7 @@ type TFTeamDSModel struct {
138138
type TFCloudUsersDSModel struct {
139139
ID types.String `tfsdk:"id"`
140140
OrgMembershipStatus types.String `tfsdk:"org_membership_status"`
141-
Roles types.List `tfsdk:"roles"`
141+
Roles types.Set `tfsdk:"roles"`
142142
Username types.String `tfsdk:"username"`
143143
InvitationCreatedAt types.String `tfsdk:"invitation_created_at"`
144144
InvitationExpiresAt types.String `tfsdk:"invitation_expires_at"`
@@ -229,7 +229,7 @@ func NewTFCloudUsersDataSourceModel(ctx context.Context, cloudUsers []admin.Grou
229229
users := make([]*TFCloudUsersDSModel, len(cloudUsers))
230230
for i := range cloudUsers {
231231
cloudUser := &cloudUsers[i]
232-
roles, _ := types.ListValueFrom(ctx, types.StringType, cloudUser.Roles)
232+
roles, _ := types.SetValueFrom(ctx, types.StringType, cloudUser.Roles)
233233
users[i] = &TFCloudUsersDSModel{
234234
ID: types.StringValue(cloudUser.Id),
235235
OrgMembershipStatus: types.StringValue(cloudUser.OrgMembershipStatus),

internal/service/project/model_project_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ var (
118118
Username: types.StringValue("[email protected]"),
119119
FirstName: types.StringValue("FirstName1"),
120120
LastName: types.StringValue("LastName1"),
121-
Roles: roleList,
121+
Roles: roleSet,
122122
InvitationCreatedAt: types.StringNull(),
123123
InvitationExpiresAt: types.StringNull(),
124124
InviterUsername: types.StringValue(inviterUsername),
@@ -133,7 +133,7 @@ var (
133133
Username: types.StringValue("[email protected]"),
134134
FirstName: types.StringValue("FirstName2"),
135135
LastName: types.StringValue("LastName2"),
136-
Roles: roleList,
136+
Roles: roleSet,
137137
InvitationCreatedAt: types.StringNull(),
138138
InvitationExpiresAt: types.StringNull(),
139139
InviterUsername: types.StringValue(inviterUsername),

0 commit comments

Comments
 (0)