From 22e4b99cd01d0972c861a2e3906f47772501759d Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Wed, 30 Oct 2024 14:21:48 -0500 Subject: [PATCH] Fix: env0_variable_set_assignment 404, Error: failed to unassign variable sets: 404 Not Found: Configuration Set "..." is not assigned to project. --- env0/resource_variable_set_assignment.go | 3 +-- env0/resource_variable_set_assignment_test.go | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/env0/resource_variable_set_assignment.go b/env0/resource_variable_set_assignment.go index f1785c7b..97901f33 100644 --- a/env0/resource_variable_set_assignment.go +++ b/env0/resource_variable_set_assignment.go @@ -2,7 +2,6 @@ package env0 import ( "context" - "strings" "github.com/env0/terraform-provider-env0/client" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" @@ -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 } diff --git a/env0/resource_variable_set_assignment_test.go b/env0/resource_variable_set_assignment_test.go index 26fb6388..8d3a8603 100644 --- a/env0/resource_variable_set_assignment_test.go +++ b/env0/resource_variable_set_assignment_test.go @@ -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{