Skip to content

Commit

Permalink
Fix: env0_variable_set_assignment 404, Error: failed to unassign vari…
Browse files Browse the repository at this point in the history
…able sets: 404 Not Found: Configuration Set "..." is not assigned to project. (#967)
  • Loading branch information
TomerHeber authored Oct 30, 2024
1 parent 9a78b65 commit 150c424
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions env0/resource_variable_set_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package env0

import (
"context"
"strings"

"github.com/env0/terraform-provider-env0/client"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand Down Expand Up @@ -90,7 +89,7 @@ func resourceVariableSetAssignmentUpdate(ctx context.Context, d *schema.Resource

// In API but not in Schema - delete.
for _, apiConfigurationSet := range apiConfigurationSets {
if !strings.EqualFold(apiConfigurationSet.AssignmentScope, assignmentSchema.Scope) {
if apiConfigurationSet.AssignmentScopeId != assignmentSchema.ScopeId {
continue
}

Expand Down
5 changes: 5 additions & 0 deletions env0/resource_variable_set_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ func TestUnitVariableSetAssignmentResource(t *testing.T) {
AssignmentScope: scope,
AssignmentScopeId: scopeId,
},
{
Id: "a1111",
AssignmentScope: scope,
AssignmentScopeId: "some other scope id",
},
}

testCase := resource.TestCase{
Expand Down

0 comments on commit 150c424

Please sign in to comment.