Skip to content

Commit 150c424

Browse files
authored
Fix: env0_variable_set_assignment 404, Error: failed to unassign variable sets: 404 Not Found: Configuration Set "..." is not assigned to project. (#967)
1 parent 9a78b65 commit 150c424

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

env0/resource_variable_set_assignment.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package env0
22

33
import (
44
"context"
5-
"strings"
65

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

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

env0/resource_variable_set_assignment_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ func TestUnitVariableSetAssignmentResource(t *testing.T) {
6161
AssignmentScope: scope,
6262
AssignmentScopeId: scopeId,
6363
},
64+
{
65+
Id: "a1111",
66+
AssignmentScope: scope,
67+
AssignmentScopeId: "some other scope id",
68+
},
6469
}
6570

6671
testCase := resource.TestCase{

0 commit comments

Comments
 (0)