Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: env0_variable_set_assignment 404, Error: failed to unassign vari… #967

Merged
merged 1 commit into from
Oct 30, 2024
Merged
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
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,
},
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added this use case: this should be filtered out.
(Which mean the test outcome shouldn't change).

Id: "a1111",
AssignmentScope: scope,
AssignmentScopeId: "some other scope id",
},
}

testCase := resource.TestCase{
Expand Down
Loading