diff --git a/docs/resources/team.md b/docs/resources/team.md index def1a31..d3fe342 100644 --- a/docs/resources/team.md +++ b/docs/resources/team.md @@ -32,9 +32,9 @@ resource "linear_team" "example" { - `auto_archive_period` (Number) Period after which closed and completed issues are automatically archived, in months. **Default** `6`. - `auto_close_period` (Number) Period after which non-completed or non-canceled issues are automatically closed, in months. **Default** `6`. *Use `0` for turning this off.* - `backlog_workflow_state` (Attributes) Settings for the `backlog` workflow state that is created by default for the team. *Position is always `0`. This can not be deleted.* (see [below for nested schema](#nestedatt--backlog_workflow_state)) -- `canceled_workflow_state` (Attributes) Settings for the `canceled` workflow state that is created by default for the team. *Position is always `4`. This can not be deleted.* (see [below for nested schema](#nestedatt--canceled_workflow_state)) +- `canceled_workflow_state` (Attributes) Settings for the `canceled` workflow state that is created by default for the team. *Position is always `0`. This can not be deleted.* (see [below for nested schema](#nestedatt--canceled_workflow_state)) - `color` (String) Color of the team. -- `completed_workflow_state` (Attributes) Settings for the `completed` workflow state that is created by default for the team. *Position is always `3`. This can not be deleted.* (see [below for nested schema](#nestedatt--completed_workflow_state)) +- `completed_workflow_state` (Attributes) Settings for the `completed` workflow state that is created by default for the team. *Position is always `0`. This can not be deleted.* (see [below for nested schema](#nestedatt--completed_workflow_state)) - `cycles` (Attributes) Cycle settings of the team. (see [below for nested schema](#nestedatt--cycles)) - `description` (String) Description of the team. - `enable_issue_default_to_bottom` (Boolean) Enable moving issues to bottom of the column when changing state. **Default** `false`. @@ -43,10 +43,10 @@ resource "linear_team" "example" { - `icon` (String) Icon of the team. - `no_priority_issues_first` (Boolean) Prefer issues without priority at the top during issue prioritization order. **Default** `true`. - `private` (Boolean) Privacy of the team. **Default** `false`. -- `started_workflow_state` (Attributes) Settings for the `started` workflow state that is created by default for the team. *Position is always `2`. This can not be deleted.* (see [below for nested schema](#nestedatt--started_workflow_state)) +- `started_workflow_state` (Attributes) Settings for the `started` workflow state that is created by default for the team. *Position is always `0`. This can not be deleted.* (see [below for nested schema](#nestedatt--started_workflow_state)) - `timezone` (String) Timezone of the team. **Default** `Etc/GMT`. - `triage` (Attributes) Triage settings of the team. (see [below for nested schema](#nestedatt--triage)) -- `unstarted_workflow_state` (Attributes) Settings for the `unstarted` workflow state that is created by default for the team. *Position is always `1`. This can not be deleted.* (see [below for nested schema](#nestedatt--unstarted_workflow_state)) +- `unstarted_workflow_state` (Attributes) Settings for the `unstarted` workflow state that is created by default for the team. *Position is always `0`. This can not be deleted.* (see [below for nested schema](#nestedatt--unstarted_workflow_state)) ### Read-Only @@ -64,6 +64,7 @@ Optional: Read-Only: - `id` (String) Identifier of the workflow state. +- `position` (Number) Position of the workflow state. @@ -78,6 +79,7 @@ Optional: Read-Only: - `id` (String) Identifier of the workflow state. +- `position` (Number) Position of the workflow state. @@ -92,6 +94,7 @@ Optional: Read-Only: - `id` (String) Identifier of the workflow state. +- `position` (Number) Position of the workflow state. @@ -132,6 +135,7 @@ Optional: Read-Only: - `id` (String) Identifier of the workflow state. +- `position` (Number) Position of the workflow state. @@ -154,6 +158,7 @@ Optional: Read-Only: - `id` (String) Identifier of the workflow state. +- `position` (Number) Position of the workflow state. ## Import diff --git a/docs/resources/workspace_settings.md b/docs/resources/workspace_settings.md index 1cf1e82..82d2fdf 100644 --- a/docs/resources/workspace_settings.md +++ b/docs/resources/workspace_settings.md @@ -36,5 +36,5 @@ resource "linear_workspace_settings" "example" { Import is supported using the following syntax: ```shell -terraform import linear_workspace_settings.example +terraform import linear_workspace_settings.example example ``` diff --git a/internal/provider/generated.go b/internal/provider/generated.go index ba7f72c..eec24a9 100644 --- a/internal/provider/generated.go +++ b/internal/provider/generated.go @@ -969,7 +969,7 @@ type WorkflowStateUpdateInput struct { // The description of the state. Description *string `json:"description"` // The position of the state. - Position float64 `json:"position,omitempty"` + Position float64 `json:"position"` } // GetName returns WorkflowStateUpdateInput.Name, and is useful for accessing the field via an interface. diff --git a/internal/provider/resource_team.go b/internal/provider/resource_team.go index 6a92770..ec0301c 100644 --- a/internal/provider/resource_team.go +++ b/internal/provider/resource_team.go @@ -52,10 +52,11 @@ type TeamResourceEstimationModel struct { } type TeamResourceWorkflowStateModel struct { - Id types.String `tfsdk:"id"` - Name types.String `tfsdk:"name"` - Color types.String `tfsdk:"color"` - Description types.String `tfsdk:"description"` + Id types.String `tfsdk:"id"` + Position types.Float64 `tfsdk:"position"` + Name types.String `tfsdk:"name"` + Color types.String `tfsdk:"color"` + Description types.String `tfsdk:"description"` } type TeamResourceModel struct { @@ -401,6 +402,14 @@ func (r *TeamResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagno resource.UseStateForUnknown(), }, }, + "position": { + MarkdownDescription: "Position of the workflow state.", + Type: types.Float64Type, + Computed: true, + PlanModifiers: tfsdk.AttributePlanModifiers{ + resource.UseStateForUnknown(), + }, + }, "name": { MarkdownDescription: "Name of the workflow state. **Default** `Backlog`.", Type: types.StringType, @@ -434,7 +443,7 @@ func (r *TeamResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagno }), }, "unstarted_workflow_state": { - MarkdownDescription: "Settings for the `unstarted` workflow state that is created by default for the team. *Position is always `1`. This can not be deleted.*", + MarkdownDescription: "Settings for the `unstarted` workflow state that is created by default for the team. *Position is always `0`. This can not be deleted.*", Optional: true, Computed: true, PlanModifiers: tfsdk.AttributePlanModifiers{ @@ -449,6 +458,14 @@ func (r *TeamResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagno resource.UseStateForUnknown(), }, }, + "position": { + MarkdownDescription: "Position of the workflow state.", + Type: types.Float64Type, + Computed: true, + PlanModifiers: tfsdk.AttributePlanModifiers{ + resource.UseStateForUnknown(), + }, + }, "name": { MarkdownDescription: "Name of the workflow state. **Default** `Todo`.", Type: types.StringType, @@ -482,7 +499,7 @@ func (r *TeamResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagno }), }, "started_workflow_state": { - MarkdownDescription: "Settings for the `started` workflow state that is created by default for the team. *Position is always `2`. This can not be deleted.*", + MarkdownDescription: "Settings for the `started` workflow state that is created by default for the team. *Position is always `0`. This can not be deleted.*", Optional: true, Computed: true, PlanModifiers: tfsdk.AttributePlanModifiers{ @@ -497,6 +514,14 @@ func (r *TeamResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagno resource.UseStateForUnknown(), }, }, + "position": { + MarkdownDescription: "Position of the workflow state.", + Type: types.Float64Type, + Computed: true, + PlanModifiers: tfsdk.AttributePlanModifiers{ + resource.UseStateForUnknown(), + }, + }, "name": { MarkdownDescription: "Name of the workflow state. **Default** `In Progress`.", Type: types.StringType, @@ -530,7 +555,7 @@ func (r *TeamResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagno }), }, "completed_workflow_state": { - MarkdownDescription: "Settings for the `completed` workflow state that is created by default for the team. *Position is always `3`. This can not be deleted.*", + MarkdownDescription: "Settings for the `completed` workflow state that is created by default for the team. *Position is always `0`. This can not be deleted.*", Optional: true, Computed: true, PlanModifiers: tfsdk.AttributePlanModifiers{ @@ -545,6 +570,14 @@ func (r *TeamResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagno resource.UseStateForUnknown(), }, }, + "position": { + MarkdownDescription: "Position of the workflow state.", + Type: types.Float64Type, + Computed: true, + PlanModifiers: tfsdk.AttributePlanModifiers{ + resource.UseStateForUnknown(), + }, + }, "name": { MarkdownDescription: "Name of the workflow state. **Default** `Done`.", Type: types.StringType, @@ -578,7 +611,7 @@ func (r *TeamResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagno }), }, "canceled_workflow_state": { - MarkdownDescription: "Settings for the `canceled` workflow state that is created by default for the team. *Position is always `4`. This can not be deleted.*", + MarkdownDescription: "Settings for the `canceled` workflow state that is created by default for the team. *Position is always `0`. This can not be deleted.*", Optional: true, Computed: true, PlanModifiers: tfsdk.AttributePlanModifiers{ @@ -593,6 +626,14 @@ func (r *TeamResource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagno resource.UseStateForUnknown(), }, }, + "position": { + MarkdownDescription: "Position of the workflow state.", + Type: types.Float64Type, + Computed: true, + PlanModifiers: tfsdk.AttributePlanModifiers{ + resource.UseStateForUnknown(), + }, + }, "name": { MarkdownDescription: "Name of the workflow state. **Default** `Canceled`.", Type: types.StringType, @@ -817,11 +858,11 @@ func (r *TeamResource) Create(ctx context.Context, req resource.CreateRequest, r tflog.Trace(ctx, "read team workflow states") - backlogWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "backlog", 0) - unstartedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "unstarted", 1) - startedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "started", 2) - completedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "completed", 3) - canceledWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "canceled", 4) + backlogWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "backlog") + unstartedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "unstarted") + startedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "started") + completedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "completed") + canceledWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "canceled") if backlogWorkflowState == nil || unstartedWorkflowState == nil || startedWorkflowState == nil || completedWorkflowState == nil || canceledWorkflowState == nil { resp.Diagnostics.AddError("Client Error", "Unable to find all workflow states in a new team") @@ -950,11 +991,11 @@ func (r *TeamResource) Read(ctx context.Context, req resource.ReadRequest, resp tflog.Trace(ctx, "read team workflow states") - backlogWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "backlog", 0) - unstartedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "unstarted", 1) - startedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "started", 2) - completedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "completed", 3) - canceledWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "canceled", 4) + backlogWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "backlog") + unstartedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "unstarted") + startedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "started") + completedWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "completed") + canceledWorkflowState := findWorkflowStateType(workflowStatesResponse.WorkflowStates.Nodes, "canceled") if backlogWorkflowState == nil || unstartedWorkflowState == nil || startedWorkflowState == nil || completedWorkflowState == nil || canceledWorkflowState == nil { resp.Diagnostics.AddError("Client Error", "Unable to find all workflow states when reading team") @@ -1189,9 +1230,9 @@ func (r *TeamResource) ImportState(ctx context.Context, req resource.ImportState resource.ImportStatePassthroughID(ctx, path.Root("key"), req, resp) } -func findWorkflowStateType(workflowStates []getTeamWorkflowStatesWorkflowStatesWorkflowStateConnectionNodesWorkflowState, ty string, position float64) *getTeamWorkflowStatesWorkflowStatesWorkflowStateConnectionNodesWorkflowState { +func findWorkflowStateType(workflowStates []getTeamWorkflowStatesWorkflowStatesWorkflowStateConnectionNodesWorkflowState, ty string) *getTeamWorkflowStatesWorkflowStatesWorkflowStateConnectionNodesWorkflowState { for _, workflowState := range workflowStates { - if workflowState.Type == ty && workflowState.Position == position { + if workflowState.Type == ty && workflowState.Position == 0 { return &workflowState } } @@ -1214,12 +1255,14 @@ func readWorkflowStateToObject(workflowState getTeamWorkflowStatesWorkflowStates ret := types.Object{ AttrTypes: map[string]attr.Type{ "id": types.StringType, + "position": types.Float64Type, "name": types.StringType, "color": types.StringType, "description": types.StringType, }, Attrs: map[string]attr.Value{ "id": types.String{Value: workflowState.Id}, + "position": types.Float64{Value: workflowState.Position}, "name": types.String{Value: workflowState.Name}, "color": types.String{Value: workflowState.Color}, "description": types.String{Null: true}, @@ -1237,12 +1280,14 @@ func updateWorkflowStateToObject(workflowState updateWorkflowStateWorkflowStateU ret := types.Object{ AttrTypes: map[string]attr.Type{ "id": types.StringType, + "position": types.Float64Type, "name": types.StringType, "color": types.StringType, "description": types.StringType, }, Attrs: map[string]attr.Value{ "id": types.String{Value: workflowState.Id}, + "position": types.Float64{Value: workflowState.Position}, "name": types.String{Value: workflowState.Name}, "color": types.String{Value: workflowState.Color}, "description": types.String{Null: true}, @@ -1258,9 +1303,6 @@ func updateWorkflowStateToObject(workflowState updateWorkflowStateWorkflowStateU func updateTeamWorkflowStateInCreate(ctx context.Context, r *TeamResource, data types.Object, resp *resource.CreateResponse, id string) *types.Object { var workflowStateData *TeamResourceWorkflowStateModel - var workflowStateInput WorkflowStateUpdateInput - var workflowStateResponse *updateWorkflowStateResponse - var workflowStateErr error resp.Diagnostics.Append(data.As(ctx, &workflowStateData, types.ObjectAsOptions{})...) @@ -1268,7 +1310,7 @@ func updateTeamWorkflowStateInCreate(ctx context.Context, r *TeamResource, data return nil } - workflowStateInput = WorkflowStateUpdateInput{ + workflowStateInput := WorkflowStateUpdateInput{ Name: workflowStateData.Name.Value, Color: workflowStateData.Color.Value, } @@ -1277,7 +1319,7 @@ func updateTeamWorkflowStateInCreate(ctx context.Context, r *TeamResource, data workflowStateInput.Description = &workflowStateData.Description.Value } - workflowStateResponse, workflowStateErr = updateWorkflowState(ctx, *r.client, workflowStateInput, id) + workflowStateResponse, workflowStateErr := updateWorkflowState(ctx, *r.client, workflowStateInput, id) if workflowStateErr != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to update workflow state, got error: %s", workflowStateErr)) @@ -1291,9 +1333,6 @@ func updateTeamWorkflowStateInCreate(ctx context.Context, r *TeamResource, data func updateTeamWorkflowStateInUpdate(ctx context.Context, r *TeamResource, data types.Object, resp *resource.UpdateResponse, id string) *types.Object { var workflowStateData *TeamResourceWorkflowStateModel - var workflowStateInput WorkflowStateUpdateInput - var workflowStateResponse *updateWorkflowStateResponse - var workflowStateErr error resp.Diagnostics.Append(data.As(ctx, &workflowStateData, types.ObjectAsOptions{})...) @@ -1301,7 +1340,7 @@ func updateTeamWorkflowStateInUpdate(ctx context.Context, r *TeamResource, data return nil } - workflowStateInput = WorkflowStateUpdateInput{ + workflowStateInput := WorkflowStateUpdateInput{ Name: workflowStateData.Name.Value, Color: workflowStateData.Color.Value, } @@ -1310,7 +1349,7 @@ func updateTeamWorkflowStateInUpdate(ctx context.Context, r *TeamResource, data workflowStateInput.Description = &workflowStateData.Description.Value } - workflowStateResponse, workflowStateErr = updateWorkflowState(ctx, *r.client, workflowStateInput, id) + workflowStateResponse, workflowStateErr := updateWorkflowState(ctx, *r.client, workflowStateInput, id) if workflowStateErr != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to update workflow state, got error: %s", workflowStateErr)) diff --git a/internal/provider/resource_team_test.go b/internal/provider/resource_team_test.go index f22c22a..5ff6817 100644 --- a/internal/provider/resource_team_test.go +++ b/internal/provider/resource_team_test.go @@ -43,22 +43,27 @@ func TestAccTeamResourceDefault(t *testing.T) { resource.TestCheckResourceAttr("linear_team.test", "estimation.allow_zero", "false"), resource.TestCheckResourceAttr("linear_team.test", "estimation.default", "1"), resource.TestMatchResourceAttr("linear_team.test", "backlog_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.name", "Backlog"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.color", "#bec2c8"), resource.TestCheckNoResourceAttr("linear_team.test", "backlog_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "unstarted_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.name", "Todo"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.color", "#e2e2e2"), resource.TestCheckNoResourceAttr("linear_team.test", "unstarted_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "started_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.name", "In Progress"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.color", "#f2c94c"), resource.TestCheckNoResourceAttr("linear_team.test", "started_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "completed_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.name", "Done"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.color", "#5e6ad2"), resource.TestCheckNoResourceAttr("linear_team.test", "completed_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "canceled_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.name", "Canceled"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.color", "#95a2b3"), resource.TestCheckNoResourceAttr("linear_team.test", "canceled_workflow_state.description"), @@ -102,22 +107,27 @@ func TestAccTeamResourceDefault(t *testing.T) { resource.TestCheckResourceAttr("linear_team.test", "estimation.allow_zero", "false"), resource.TestCheckResourceAttr("linear_team.test", "estimation.default", "1"), resource.TestMatchResourceAttr("linear_team.test", "backlog_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.name", "Backlog"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.color", "#bec2c8"), resource.TestCheckNoResourceAttr("linear_team.test", "backlog_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "unstarted_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.name", "Todo"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.color", "#e2e2e2"), resource.TestCheckNoResourceAttr("linear_team.test", "unstarted_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "started_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.name", "In Progress"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.color", "#f2c94c"), resource.TestCheckNoResourceAttr("linear_team.test", "started_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "completed_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.name", "Done"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.color", "#5e6ad2"), resource.TestCheckNoResourceAttr("linear_team.test", "completed_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "canceled_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.name", "Canceled"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.color", "#95a2b3"), resource.TestCheckNoResourceAttr("linear_team.test", "canceled_workflow_state.description"), @@ -154,22 +164,27 @@ func TestAccTeamResourceDefault(t *testing.T) { resource.TestCheckResourceAttr("linear_team.test", "estimation.allow_zero", "true"), resource.TestCheckResourceAttr("linear_team.test", "estimation.default", "0"), resource.TestMatchResourceAttr("linear_team.test", "backlog_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.name", "Icebox"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.color", "#bbbbbb"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.description", "Not planned"), resource.TestMatchResourceAttr("linear_team.test", "unstarted_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.name", "Ready to start"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.color", "#eeeeee"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.description", "Planned"), resource.TestMatchResourceAttr("linear_team.test", "started_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.name", "In flight"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.color", "#ffcccc"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.description", "Working on it"), resource.TestMatchResourceAttr("linear_team.test", "completed_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.name", "Merged"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.color", "#5566dd"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.description", "Merged to main"), resource.TestMatchResourceAttr("linear_team.test", "canceled_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.name", "Invalid"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.color", "#99aabb"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.description", "Not valid or not needed"), @@ -223,22 +238,27 @@ func TestAccTeamResourceNonDefault(t *testing.T) { resource.TestCheckResourceAttr("linear_team.test", "estimation.allow_zero", "true"), resource.TestCheckResourceAttr("linear_team.test", "estimation.default", "0"), resource.TestMatchResourceAttr("linear_team.test", "backlog_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.name", "Icebox"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.color", "#bbbbbb"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.description", "Not planned"), resource.TestMatchResourceAttr("linear_team.test", "unstarted_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.name", "Ready to start"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.color", "#eeeeee"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.description", "Planned"), resource.TestMatchResourceAttr("linear_team.test", "started_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.name", "In flight"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.color", "#ffcccc"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.description", "Working on it"), resource.TestMatchResourceAttr("linear_team.test", "completed_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.name", "Merged"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.color", "#5566dd"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.description", "Merged to main"), resource.TestMatchResourceAttr("linear_team.test", "canceled_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.name", "Invalid"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.color", "#99aabb"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.description", "Not valid or not needed"), @@ -282,22 +302,27 @@ func TestAccTeamResourceNonDefault(t *testing.T) { resource.TestCheckResourceAttr("linear_team.test", "estimation.allow_zero", "true"), resource.TestCheckResourceAttr("linear_team.test", "estimation.default", "0"), resource.TestMatchResourceAttr("linear_team.test", "backlog_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.name", "Icebox"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.color", "#bbbbbb"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.description", "Not planned"), resource.TestMatchResourceAttr("linear_team.test", "unstarted_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.name", "Ready to start"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.color", "#eeeeee"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.description", "Planned"), resource.TestMatchResourceAttr("linear_team.test", "started_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.name", "In flight"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.color", "#ffcccc"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.description", "Working on it"), resource.TestMatchResourceAttr("linear_team.test", "completed_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.name", "Merged"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.color", "#5566dd"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.description", "Merged to main"), resource.TestMatchResourceAttr("linear_team.test", "canceled_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.name", "Invalid"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.color", "#99aabb"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.description", "Not valid or not needed"), @@ -334,22 +359,27 @@ func TestAccTeamResourceNonDefault(t *testing.T) { resource.TestCheckResourceAttr("linear_team.test", "estimation.allow_zero", "false"), resource.TestCheckResourceAttr("linear_team.test", "estimation.default", "1"), resource.TestMatchResourceAttr("linear_team.test", "backlog_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.name", "Backlog"), resource.TestCheckResourceAttr("linear_team.test", "backlog_workflow_state.color", "#bec2c8"), resource.TestCheckNoResourceAttr("linear_team.test", "backlog_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "unstarted_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.name", "Todo"), resource.TestCheckResourceAttr("linear_team.test", "unstarted_workflow_state.color", "#e2e2e2"), resource.TestCheckNoResourceAttr("linear_team.test", "unstarted_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "started_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.name", "In Progress"), resource.TestCheckResourceAttr("linear_team.test", "started_workflow_state.color", "#f2c94c"), resource.TestCheckNoResourceAttr("linear_team.test", "started_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "completed_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.name", "Done"), resource.TestCheckResourceAttr("linear_team.test", "completed_workflow_state.color", "#5e6ad2"), resource.TestCheckNoResourceAttr("linear_team.test", "completed_workflow_state.description"), resource.TestMatchResourceAttr("linear_team.test", "canceled_workflow_state.id", uuidRegex()), + resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.position", "0"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.name", "Canceled"), resource.TestCheckResourceAttr("linear_team.test", "canceled_workflow_state.color", "#95a2b3"), resource.TestCheckNoResourceAttr("linear_team.test", "canceled_workflow_state.description"), diff --git a/internal/provider/resource_team_workflow_test.go b/internal/provider/resource_team_workflow_test.go index 5f17fb7..f448eeb 100644 --- a/internal/provider/resource_team_workflow_test.go +++ b/internal/provider/resource_team_workflow_test.go @@ -49,10 +49,10 @@ func TestAccTeamWorkflowResourceDefault(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("linear_team_workflow.test", "id", "ff0a060a-eceb-4b34-9140-fd7231f0cd28"), resource.TestCheckResourceAttr("linear_team_workflow.test", "key", "DEF"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "draft", "fbb47815-9f97-4f7b-885b-1417a83b57c0"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "start", "4e868c3b-30d2-4d9e-9f1d-a6ed42c7926a"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "review", "4e868c3b-30d2-4d9e-9f1d-a6ed42c7926a"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "merge", "b3a08038-c253-4c3b-8019-a985a0ddb6d0"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "draft", "5dbca6c1-9ee2-4bf7-a275-8b69ae27ad14"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "start", "9b6fdbd0-fd66-4ea2-a01d-a24ecf0c1191"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "review", "9b6fdbd0-fd66-4ea2-a01d-a24ecf0c1191"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "merge", "66df5c88-cae8-416b-b4e9-85a42b159e18"), ), }, // ImportState testing @@ -78,10 +78,10 @@ func TestAccTeamWorkflowResourceNonDefault(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("linear_team_workflow.test", "id", "ff0a060a-eceb-4b34-9140-fd7231f0cd28"), resource.TestCheckResourceAttr("linear_team_workflow.test", "key", "DEF"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "draft", "fbb47815-9f97-4f7b-885b-1417a83b57c0"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "start", "4e868c3b-30d2-4d9e-9f1d-a6ed42c7926a"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "review", "4e868c3b-30d2-4d9e-9f1d-a6ed42c7926a"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "merge", "b3a08038-c253-4c3b-8019-a985a0ddb6d0"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "draft", "5dbca6c1-9ee2-4bf7-a275-8b69ae27ad14"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "start", "9b6fdbd0-fd66-4ea2-a01d-a24ecf0c1191"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "review", "9b6fdbd0-fd66-4ea2-a01d-a24ecf0c1191"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "merge", "66df5c88-cae8-416b-b4e9-85a42b159e18"), ), }, // ImportState testing @@ -97,10 +97,10 @@ func TestAccTeamWorkflowResourceNonDefault(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("linear_team_workflow.test", "id", "ff0a060a-eceb-4b34-9140-fd7231f0cd28"), resource.TestCheckResourceAttr("linear_team_workflow.test", "key", "DEF"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "draft", "fbb47815-9f97-4f7b-885b-1417a83b57c0"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "start", "4e868c3b-30d2-4d9e-9f1d-a6ed42c7926a"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "review", "4e868c3b-30d2-4d9e-9f1d-a6ed42c7926a"), - resource.TestCheckResourceAttr("linear_team_workflow.test", "merge", "b3a08038-c253-4c3b-8019-a985a0ddb6d0"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "draft", "5dbca6c1-9ee2-4bf7-a275-8b69ae27ad14"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "start", "9b6fdbd0-fd66-4ea2-a01d-a24ecf0c1191"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "review", "9b6fdbd0-fd66-4ea2-a01d-a24ecf0c1191"), + resource.TestCheckResourceAttr("linear_team_workflow.test", "merge", "66df5c88-cae8-416b-b4e9-85a42b159e18"), ), }, // Update with null values @@ -132,10 +132,10 @@ func testAccTeamWorkflowResourceConfigNonDefault(key string) string { return fmt.Sprintf(` resource "linear_team_workflow" "test" { key = "%s" - draft = "fbb47815-9f97-4f7b-885b-1417a83b57c0" - start = "4e868c3b-30d2-4d9e-9f1d-a6ed42c7926a" - review = "4e868c3b-30d2-4d9e-9f1d-a6ed42c7926a" - merge = "b3a08038-c253-4c3b-8019-a985a0ddb6d0" + draft = "5dbca6c1-9ee2-4bf7-a275-8b69ae27ad14" + start = "9b6fdbd0-fd66-4ea2-a01d-a24ecf0c1191" + review = "9b6fdbd0-fd66-4ea2-a01d-a24ecf0c1191" + merge = "66df5c88-cae8-416b-b4e9-85a42b159e18" } `, key) } diff --git a/internal/provider/resource_workflow_state.graphql b/internal/provider/resource_workflow_state.graphql index 1eb7a68..8d0a880 100644 --- a/internal/provider/resource_workflow_state.graphql +++ b/internal/provider/resource_workflow_state.graphql @@ -63,7 +63,6 @@ mutation createWorkflowState( # @genqlient(for: "WorkflowStateUpdateInput.name", omitempty: true) # @genqlient(for: "WorkflowStateUpdateInput.description", pointer: true) # @genqlient(for: "WorkflowStateUpdateInput.color", omitempty: true) -# @genqlient(for: "WorkflowStateUpdateInput.position", omitempty: true) mutation updateWorkflowState( $input: WorkflowStateUpdateInput!, $id: String!