From 04b33955336c2c7b791910d5689580a5f857dbe1 Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Sat, 15 Jun 2024 12:46:40 -0500 Subject: [PATCH] Fix: removing configuration from sub_environment_configuration (#875) --- env0/resource_environment.go | 2 +- env0/resource_environment_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/env0/resource_environment.go b/env0/resource_environment.go index 5b34f053..2ed9fdf3 100644 --- a/env0/resource_environment.go +++ b/env0/resource_environment.go @@ -734,7 +734,7 @@ func deploy(d *schema.ResourceData, apiClient client.ApiClientInterface) diag.Di for i, subEnvironment := range subEnvironments { configuration := d.Get(fmt.Sprintf("sub_environment_configuration.%d.configuration", i)).([]interface{}) configurationChanges := getConfigurationVariablesFromSchema(configuration) - configurationChanges = getUpdateConfigurationVariables(configurationChanges, subEnvironment.Id, client.ScopeWorkflow, apiClient) + configurationChanges = getUpdateConfigurationVariables(configurationChanges, subEnvironment.Id, client.ScopeEnvironment, apiClient) for i := range configurationChanges { configurationChanges[i].Scope = client.ScopeEnvironment diff --git a/env0/resource_environment_test.go b/env0/resource_environment_test.go index 51989857..41323219 100644 --- a/env0/resource_environment_test.go +++ b/env0/resource_environment_test.go @@ -2593,7 +2593,7 @@ func TestUnitEnvironmentWithSubEnvironment(t *testing.T) { mock.EXPECT().ConfigurationVariablesByScope(client.ScopeWorkflow, environment.Id).Times(1).Return(client.ConfigurationChanges{configurationVariable}, nil), mock.EXPECT().Environment(environment.Id).Times(1).Return(environment, nil), mock.EXPECT().ConfigurationVariablesByScope(client.ScopeWorkflow, environment.Id).Times(1).Return(client.ConfigurationChanges{configurationVariable}, nil), - mock.EXPECT().ConfigurationVariablesByScope(client.ScopeWorkflow, subEnvrionmentWithId.Id).Times(1).Return(subEnvironment.Configuration, nil), + mock.EXPECT().ConfigurationVariablesByScope(client.ScopeEnvironment, subEnvrionmentWithId.Id).Times(1).Return(subEnvironment.Configuration, nil), mock.EXPECT().EnvironmentDeploy(environment.Id, deployRequest).Times(1).Return(client.EnvironmentDeployResponse{ Id: environment.Id, }, nil),