From f1329690718d088a47a0e8721ebf52bba11d5c95 Mon Sep 17 00:00:00 2001 From: David Debeau Date: Fri, 6 Sep 2024 13:20:04 -0500 Subject: [PATCH 1/2] Change OrganizationTeam members from a list to a set --- code_generator/provider_code_spec.json | 4 ++-- .../organization_team_data_source_gen.go | 4 ++-- internal/provider/organization_team_data_source.go | 2 +- internal/provider/organization_team_resource.go | 2 +- .../organization_team_resource_gen.go | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code_generator/provider_code_spec.json b/code_generator/provider_code_spec.json index 3eec48e..71b36c8 100644 --- a/code_generator/provider_code_spec.json +++ b/code_generator/provider_code_spec.json @@ -114,7 +114,7 @@ }, { "name": "members", - "list": { + "set": { "computed_optional_required": "optional", "description": "List of team members", "element_type": { @@ -413,7 +413,7 @@ }, { "name": "members", - "list": { + "set": { "computed_optional_required": "computed", "description": "List of team members", "element_type": { diff --git a/internal/datasource_organization_team/organization_team_data_source_gen.go b/internal/datasource_organization_team/organization_team_data_source_gen.go index aee0544..0229d20 100644 --- a/internal/datasource_organization_team/organization_team_data_source_gen.go +++ b/internal/datasource_organization_team/organization_team_data_source_gen.go @@ -17,7 +17,7 @@ func OrganizationTeamDataSourceSchema(ctx context.Context) schema.Schema { Description: "Markdown description", MarkdownDescription: "Markdown description", }, - "members": schema.ListAttribute{ + "members": schema.SetAttribute{ ElementType: types.StringType, Computed: true, Description: "List of team members", @@ -44,7 +44,7 @@ func OrganizationTeamDataSourceSchema(ctx context.Context) schema.Schema { type OrganizationTeamModel struct { Description types.String `tfsdk:"description"` - Members types.List `tfsdk:"members"` + Members types.Set `tfsdk:"members"` Name types.String `tfsdk:"name"` Orgname types.String `tfsdk:"orgname"` Role types.String `tfsdk:"role"` diff --git a/internal/provider/organization_team_data_source.go b/internal/provider/organization_team_data_source.go index c62cbad..169425b 100644 --- a/internal/provider/organization_team_data_source.go +++ b/internal/provider/organization_team_data_source.go @@ -78,7 +78,7 @@ func (d *organizationTeamDataSource) Read(ctx context.Context, req datasource.Re for _, member := range resTeamData.Members { memList = append(memList, member.Name) } - members, diags := types.ListValueFrom(ctx, types.StringType, memList) + members, diags := types.SetValueFrom(ctx, types.StringType, memList) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { diff --git a/internal/provider/organization_team_resource.go b/internal/provider/organization_team_resource.go index 89813a5..bc3e2f9 100644 --- a/internal/provider/organization_team_resource.go +++ b/internal/provider/organization_team_resource.go @@ -152,7 +152,7 @@ func (r *organizationTeamResource) Read(ctx context.Context, req resource.ReadRe for _, member := range resTeamData.Members { memList = append(memList, member.Name) } - members, diags := types.ListValueFrom(ctx, types.StringType, memList) + members, diags := types.SetValueFrom(ctx, types.StringType, memList) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { diff --git a/internal/resource_organization_team/organization_team_resource_gen.go b/internal/resource_organization_team/organization_team_resource_gen.go index 22382c4..69f5ffd 100644 --- a/internal/resource_organization_team/organization_team_resource_gen.go +++ b/internal/resource_organization_team/organization_team_resource_gen.go @@ -24,7 +24,7 @@ func OrganizationTeamResourceSchema(ctx context.Context) schema.Schema { MarkdownDescription: "Markdown description", Default: stringdefault.StaticString(""), }, - "members": schema.ListAttribute{ + "members": schema.SetAttribute{ ElementType: types.StringType, Optional: true, Description: "List of team members", @@ -60,7 +60,7 @@ func OrganizationTeamResourceSchema(ctx context.Context) schema.Schema { type OrganizationTeamModel struct { Description types.String `tfsdk:"description"` - Members types.List `tfsdk:"members"` + Members types.Set `tfsdk:"members"` Name types.String `tfsdk:"name"` Orgname types.String `tfsdk:"orgname"` Role types.String `tfsdk:"role"` From 242273af6c1883bf232e489bd4d38681761e6758 Mon Sep 17 00:00:00 2001 From: David Debeau Date: Fri, 6 Sep 2024 13:35:01 -0500 Subject: [PATCH 2/2] Update documentation --- docs/data-sources/organization_team.md | 2 +- docs/resources/organization_team.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/data-sources/organization_team.md b/docs/data-sources/organization_team.md index bd9955f..de67e6f 100644 --- a/docs/data-sources/organization_team.md +++ b/docs/data-sources/organization_team.md @@ -45,5 +45,5 @@ data "quay_organization_team" "team" { ### Read-Only - `description` (String) Markdown description -- `members` (List of String) List of team members +- `members` (Set of String) List of team members - `role` (String) Team role diff --git a/docs/resources/organization_team.md b/docs/resources/organization_team.md index 1b0d416..6579e41 100644 --- a/docs/resources/organization_team.md +++ b/docs/resources/organization_team.md @@ -45,7 +45,7 @@ resource "quay_organization_team" "admin" { ### Optional - `description` (String) Markdown description -- `members` (List of String) List of team members +- `members` (Set of String) List of team members ## Import