diff --git a/env0/resource_environment.go b/env0/resource_environment.go index 0383dfe0..130a190b 100644 --- a/env0/resource_environment.go +++ b/env0/resource_environment.go @@ -671,7 +671,7 @@ func getEnvironmentVariableSetIdsFromApi(d *schema.ResourceData, apiClient clien var environmentVariableSetIds []string for _, variableSet := range environmentVariableSets { - if variableSet.AssignmentScope == "ENVIRONMENT" { + if variableSet.AssignmentScope == "environment" { environmentVariableSetIds = append(environmentVariableSetIds, variableSet.Id) } } diff --git a/env0/resource_environment_test.go b/env0/resource_environment_test.go index 7bd060d9..e2457d99 100644 --- a/env0/resource_environment_test.go +++ b/env0/resource_environment_test.go @@ -362,22 +362,22 @@ func TestUnitEnvironmentResource(t *testing.T) { configurationSets := []client.ConfigurationSet{ { Id: "id1", - AssignmentScope: "ENVIRONMENT", + AssignmentScope: "environment", }, { Id: "id2", - AssignmentScope: "ENVIRONMENT", + AssignmentScope: "environment", }, } updatedConfigurationSets := []client.ConfigurationSet{ { Id: "id2", - AssignmentScope: "ENVIRONMENT", + AssignmentScope: "environment", }, { Id: "id3", - AssignmentScope: "ENVIRONMENT", + AssignmentScope: "environment", }, } @@ -385,11 +385,11 @@ func TestUnitEnvironmentResource(t *testing.T) { updatedConfigurationSets2 := []client.ConfigurationSet{ { Id: "id3", - AssignmentScope: "ENVIRONMENT", + AssignmentScope: "environment", }, { Id: "id2", - AssignmentScope: "ENVIRONMENT", + AssignmentScope: "environment", }, } diff --git a/env0/resource_variable_set_assignment.go b/env0/resource_variable_set_assignment.go index 866dc001..67d1b7c0 100644 --- a/env0/resource_variable_set_assignment.go +++ b/env0/resource_variable_set_assignment.go @@ -2,6 +2,7 @@ package env0 import ( "context" + "strings" "github.com/env0/terraform-provider-env0/client" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" @@ -89,7 +90,7 @@ func resourceVariableSetAssignmentUpdate(ctx context.Context, d *schema.Resource // In API but not in Schema - delete. for _, apiConfigurationSet := range apiConfigurationSets { - if apiConfigurationSet.AssignmentScope != assignmentSchema.Scope { + if !strings.EqualFold(apiConfigurationSet.AssignmentScope, assignmentSchema.Scope) { continue } @@ -187,7 +188,7 @@ func resourceVariableSetAssignmentRead(ctx context.Context, d *schema.ResourceDa } for _, apiConfigurationSet := range apiConfigurationSets { - if apiConfigurationSet.AssignmentScope != assignmentSchema.Scope { + if !strings.EqualFold(apiConfigurationSet.AssignmentScope, assignmentSchema.Scope) { continue }