diff --git a/buildkite/data_source_team.go b/buildkite/data_source_team.go index f8884ab9..a01bab33 100644 --- a/buildkite/data_source_team.go +++ b/buildkite/data_source_team.go @@ -148,7 +148,7 @@ func updateTeamDatasourceStateFromSlug(state *teamDatasourceModel, data GetTeamF state.Slug = types.StringValue(data.Team.TeamFields.Slug) state.Name = types.StringValue(data.Team.TeamFields.Name) state.Privacy = types.StringValue(data.Team.TeamFields.Privacy) - state.Description = types.StringPointerValue(data.Team.TeamFields.Description) + state.Description = types.StringValue(data.Team.TeamFields.Description) state.IsDefaultTeam = types.BoolValue(data.Team.TeamFields.IsDefaultTeam) state.DefaultMemberRole = types.StringValue(data.Team.TeamFields.DefaultMemberRole) state.MembersCanCreatePipelines = types.BoolValue(data.Team.TeamFields.MembersCanCreatePipelines) @@ -160,7 +160,7 @@ func updateTeamDatasourceState(state *teamDatasourceModel, data getNodeNodeTeam) state.Slug = types.StringValue(data.Slug) state.Name = types.StringValue(data.Name) state.Privacy = types.StringValue(string(data.GetPrivacy())) - state.Description = types.StringPointerValue(data.Description) + state.Description = types.StringValue(data.Description) state.IsDefaultTeam = types.BoolValue(data.IsDefaultTeam) state.DefaultMemberRole = types.StringValue(string(data.GetDefaultMemberRole())) state.MembersCanCreatePipelines = types.BoolValue(data.MembersCanCreatePipelines) diff --git a/buildkite/generated.go b/buildkite/generated.go index 13d0d76b..794bd70b 100644 --- a/buildkite/generated.go +++ b/buildkite/generated.go @@ -179,7 +179,7 @@ func (v *GetTeamFromSlugTeam) GetUuid() string { return v.TeamFields.Uuid } func (v *GetTeamFromSlugTeam) GetName() string { return v.TeamFields.Name } // GetDescription returns GetTeamFromSlugTeam.Description, and is useful for accessing the field via an interface. -func (v *GetTeamFromSlugTeam) GetDescription() *string { return v.TeamFields.Description } +func (v *GetTeamFromSlugTeam) GetDescription() string { return v.TeamFields.Description } // GetSlug returns GetTeamFromSlugTeam.Slug, and is useful for accessing the field via an interface. func (v *GetTeamFromSlugTeam) GetSlug() string { return v.TeamFields.Slug } @@ -230,7 +230,7 @@ type __premarshalGetTeamFromSlugTeam struct { Name string `json:"name"` - Description *string `json:"description"` + Description string `json:"description"` Slug string `json:"slug"` @@ -1099,7 +1099,7 @@ type TeamFields struct { // The name of the team Name string `json:"name"` // A description of the team - Description *string `json:"description"` + Description string `json:"description"` // The slug of the team Slug string `json:"slug"` // The privacy setting for this team @@ -1122,7 +1122,7 @@ func (v *TeamFields) GetUuid() string { return v.Uuid } func (v *TeamFields) GetName() string { return v.Name } // GetDescription returns TeamFields.Description, and is useful for accessing the field via an interface. -func (v *TeamFields) GetDescription() *string { return v.Description } +func (v *TeamFields) GetDescription() string { return v.Description } // GetSlug returns TeamFields.Slug, and is useful for accessing the field via an interface. func (v *TeamFields) GetSlug() string { return v.Slug } @@ -1798,13 +1798,13 @@ func (v *__setOrganization2FAInput) GetValue() bool { return v.Value } // __teamCreateInput is used internally by genqlient type __teamCreateInput struct { - OrganizationID string `json:"organizationID"` - Name string `json:"name"` - Description *string `json:"description"` - Privacy string `json:"privacy"` - IsDefaultTeam bool `json:"isDefaultTeam"` - DefaultMemberRole string `json:"defaultMemberRole"` - MembersCanCreatePipelines bool `json:"membersCanCreatePipelines"` + OrganizationID string `json:"organizationID"` + Name string `json:"name"` + Description string `json:"description"` + Privacy string `json:"privacy"` + IsDefaultTeam bool `json:"isDefaultTeam"` + DefaultMemberRole string `json:"defaultMemberRole"` + MembersCanCreatePipelines bool `json:"membersCanCreatePipelines"` } // GetOrganizationID returns __teamCreateInput.OrganizationID, and is useful for accessing the field via an interface. @@ -1814,7 +1814,7 @@ func (v *__teamCreateInput) GetOrganizationID() string { return v.OrganizationID func (v *__teamCreateInput) GetName() string { return v.Name } // GetDescription returns __teamCreateInput.Description, and is useful for accessing the field via an interface. -func (v *__teamCreateInput) GetDescription() *string { return v.Description } +func (v *__teamCreateInput) GetDescription() string { return v.Description } // GetPrivacy returns __teamCreateInput.Privacy, and is useful for accessing the field via an interface. func (v *__teamCreateInput) GetPrivacy() string { return v.Privacy } @@ -1838,13 +1838,13 @@ func (v *__teamDeleteInput) GetId() string { return v.Id } // __teamUpdateInput is used internally by genqlient type __teamUpdateInput struct { - Id string `json:"id"` - Name string `json:"name"` - Description *string `json:"description"` - Privacy string `json:"privacy"` - IsDefaultTeam bool `json:"isDefaultTeam"` - DefaultMemberRole string `json:"defaultMemberRole"` - MembersCanCreatePipelines bool `json:"membersCanCreatePipelines"` + Id string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Privacy string `json:"privacy"` + IsDefaultTeam bool `json:"isDefaultTeam"` + DefaultMemberRole string `json:"defaultMemberRole"` + MembersCanCreatePipelines bool `json:"membersCanCreatePipelines"` } // GetId returns __teamUpdateInput.Id, and is useful for accessing the field via an interface. @@ -1854,7 +1854,7 @@ func (v *__teamUpdateInput) GetId() string { return v.Id } func (v *__teamUpdateInput) GetName() string { return v.Name } // GetDescription returns __teamUpdateInput.Description, and is useful for accessing the field via an interface. -func (v *__teamUpdateInput) GetDescription() *string { return v.Description } +func (v *__teamUpdateInput) GetDescription() string { return v.Description } // GetPrivacy returns __teamUpdateInput.Privacy, and is useful for accessing the field via an interface. func (v *__teamUpdateInput) GetPrivacy() string { return v.Privacy } @@ -5867,7 +5867,7 @@ func (v *getNodeNodeTeam) GetUuid() string { return v.TeamFields.Uuid } func (v *getNodeNodeTeam) GetName() string { return v.TeamFields.Name } // GetDescription returns getNodeNodeTeam.Description, and is useful for accessing the field via an interface. -func (v *getNodeNodeTeam) GetDescription() *string { return v.TeamFields.Description } +func (v *getNodeNodeTeam) GetDescription() string { return v.TeamFields.Description } // GetSlug returns getNodeNodeTeam.Slug, and is useful for accessing the field via an interface. func (v *getNodeNodeTeam) GetSlug() string { return v.TeamFields.Slug } @@ -5920,7 +5920,7 @@ type __premarshalgetNodeNodeTeam struct { Name string `json:"name"` - Description *string `json:"description"` + Description string `json:"description"` Slug string `json:"slug"` @@ -10612,7 +10612,7 @@ func (v *teamCreateTeamCreateTeamCreatePayloadTeamEdgeNodeTeam) GetName() string } // GetDescription returns teamCreateTeamCreateTeamCreatePayloadTeamEdgeNodeTeam.Description, and is useful for accessing the field via an interface. -func (v *teamCreateTeamCreateTeamCreatePayloadTeamEdgeNodeTeam) GetDescription() *string { +func (v *teamCreateTeamCreateTeamCreatePayloadTeamEdgeNodeTeam) GetDescription() string { return v.TeamFields.Description } @@ -10673,7 +10673,7 @@ type __premarshalteamCreateTeamCreateTeamCreatePayloadTeamEdgeNodeTeam struct { Name string `json:"name"` - Description *string `json:"description"` + Description string `json:"description"` Slug string `json:"slug"` @@ -10773,7 +10773,7 @@ func (v *teamUpdateTeamUpdateTeamUpdatePayloadTeam) GetUuid() string { return v. func (v *teamUpdateTeamUpdateTeamUpdatePayloadTeam) GetName() string { return v.TeamFields.Name } // GetDescription returns teamUpdateTeamUpdateTeamUpdatePayloadTeam.Description, and is useful for accessing the field via an interface. -func (v *teamUpdateTeamUpdateTeamUpdatePayloadTeam) GetDescription() *string { +func (v *teamUpdateTeamUpdateTeamUpdatePayloadTeam) GetDescription() string { return v.TeamFields.Description } @@ -10830,7 +10830,7 @@ type __premarshalteamUpdateTeamUpdateTeamUpdatePayloadTeam struct { Name string `json:"name"` - Description *string `json:"description"` + Description string `json:"description"` Slug string `json:"slug"` @@ -14259,7 +14259,7 @@ func teamCreate( client graphql.Client, organizationID string, name string, - description *string, + description string, privacy string, isDefaultTeam bool, defaultMemberRole string, @@ -14354,7 +14354,7 @@ func teamUpdate( client graphql.Client, id string, name string, - description *string, + description string, privacy string, isDefaultTeam bool, defaultMemberRole string, diff --git a/buildkite/graphql/team.graphql b/buildkite/graphql/team.graphql index e95c0b75..f45254d3 100644 --- a/buildkite/graphql/team.graphql +++ b/buildkite/graphql/team.graphql @@ -2,7 +2,6 @@ fragment TeamFields on Team { id uuid name - # @genqlient(pointer: true) description slug privacy @@ -20,7 +19,6 @@ query GetTeamFromSlug($slug: ID!){ mutation teamCreate( $organizationID: ID! $name: String! - # @genqlient(pointer: true) $description: String $privacy: TeamPrivacy! $isDefaultTeam: Boolean! @@ -49,7 +47,6 @@ mutation teamCreate( mutation teamUpdate( $id: ID! $name: String! - # @genqlient(pointer: true) $description: String $privacy: TeamPrivacy! $isDefaultTeam: Boolean! diff --git a/buildkite/resource_team.go b/buildkite/resource_team.go index 15c1d68f..b0d3b21a 100644 --- a/buildkite/resource_team.go +++ b/buildkite/resource_team.go @@ -11,6 +11,7 @@ import ( resource_schema "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" @@ -87,6 +88,8 @@ func (t *teamResource) Schema(ctx context.Context, req resource.SchemaRequest, r Required: true, }, "description": resource_schema.StringAttribute{ + Computed: true, + Default: stringdefault.StaticString(""), Optional: true, MarkdownDescription: "A description for the team. This is displayed in the Buildkite UI.", }, @@ -154,7 +157,7 @@ func (t *teamResource) Create(ctx context.Context, req resource.CreateRequest, r t.client.genqlient, *org, state.Name.ValueString(), - state.Description.ValueStringPointer(), + state.Description.ValueString(), state.Privacy.ValueString(), state.IsDefaultTeam.ValueBool(), state.DefaultMemberRole.ValueString(), @@ -259,7 +262,7 @@ func (t *teamResource) Update(ctx context.Context, req resource.UpdateRequest, r t.client.genqlient, state.ID.ValueString(), plan.Name.ValueString(), - plan.Description.ValueStringPointer(), + plan.Description.ValueString(), plan.Privacy.ValueString(), plan.IsDefaultTeam.ValueBool(), plan.DefaultMemberRole.ValueString(), @@ -322,7 +325,7 @@ func updateTeamResourceState(state *teamResourceModel, res getNodeNodeTeam) { state.Slug = types.StringValue(res.Slug) state.Name = types.StringValue(res.Name) state.Privacy = types.StringValue(string(res.GetPrivacy())) - state.Description = types.StringPointerValue(res.Description) + state.Description = types.StringValue(res.Description) state.IsDefaultTeam = types.BoolValue(res.IsDefaultTeam) state.DefaultMemberRole = types.StringValue(string(res.GetDefaultMemberRole())) state.MembersCanCreatePipelines = types.BoolValue(res.MembersCanCreatePipelines)