Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/hashicorp/go-slug v0.16.4
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/jsonapi v1.4.1
github.com/hashicorp/jsonapi v1.4.2
github.com/stretchr/testify v1.10.0
go.uber.org/mock v0.4.0
golang.org/x/sync v0.10.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/jsonapi v1.4.1 h1:U6CZvnS70Sg7im0kpfhWAoF3NasLumaMndQhEWniHZA=
github.com/hashicorp/jsonapi v1.4.1/go.mod h1:kWfdn49yCjQvbpnvY1dxxAuAFzISwrrMDQOcu6NsFoM=
github.com/hashicorp/jsonapi v1.4.2 h1:xStWfremTIAi9cIMyiwt+Vpzq0SOLzekr08LLJQPoB0=
github.com/hashicorp/jsonapi v1.4.2/go.mod h1:kWfdn49yCjQvbpnvY1dxxAuAFzISwrrMDQOcu6NsFoM=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
3 changes: 1 addition & 2 deletions helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1251,9 +1251,8 @@ func applyableStatuses(r *Run) []RunStatus {
}
} else if r.CostEstimate != nil {
return []RunStatus{RunCostEstimated}
} else {
return []RunStatus{RunPlanned}
}
return []RunStatus{RunPlanned}
}

// pollRunStatus will poll the given run until its status matches one of the given run statuses or the given context
Expand Down
16 changes: 10 additions & 6 deletions internal_run_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,22 @@ func (irt internalRunTask) ToRunTask() *RunTask {
obj.WorkspaceRunTasks = workspaceTasks

// Check if the global configuration exists
if val, ok := irt.RawGlobal["enabled"]; !ok {
val, ok := irt.RawGlobal["enabled"]
if !ok {
// The enabled property is required so we can assume now that the
// global configuration was not supplied
return &obj
} else if boolVal, ok := val.(bool); !ok {
}

boolVal, ok := val.(bool)
if !ok {
// The enabled property exists but it is invalid (Couldn't cast to boolean)
// so assume the global configuration was not supplied
return &obj
} else {
obj.Global = &GlobalRunTask{
Enabled: boolVal,
}
}

obj.Global = &GlobalRunTask{
Enabled: boolVal,
}

// Global Enforcement Level
Expand Down
6 changes: 3 additions & 3 deletions run_task_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import (

func hasGlobalRunTasks(client *Client, organizationName string) (bool, error) {
ctx := context.Background()
if orgEntitlements, err := client.Organizations.ReadEntitlements(ctx, organizationName); err != nil {
orgEntitlements, err := client.Organizations.ReadEntitlements(ctx, organizationName)
if err != nil {
return false, err
} else if orgEntitlements == nil {
return false, errors.New("The organization entitlements are empty.")
} else {
return orgEntitlements.GlobalRunTasks, nil
}
return orgEntitlements.GlobalRunTasks, nil
}

func TestRunTasksCreate(t *testing.T) {
Expand Down
Loading