From e453355e11a799c3dd868d6da8449638baf03a8d Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Wed, 14 Feb 2024 10:19:49 -0600 Subject: [PATCH] =?UTF-8?q?Fix:=20changing=20terragrunt=5Fworking=5Fdirect?= =?UTF-8?q?ory=20for=20an=20environment=20should=20=E2=80=A6=20(#793)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix: changing terragrunt_working_directory for an environment should force replacement instead of update in place * remove from shouldUpdate --- env0/resource_environment.go | 5 +++-- env0/resource_environment_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/env0/resource_environment.go b/env0/resource_environment.go index b0a0e4da..2226b923 100644 --- a/env0/resource_environment.go +++ b/env0/resource_environment.go @@ -251,7 +251,8 @@ func resourceEnvironment() *schema.Resource { }, "terragrunt_working_directory": { Type: schema.TypeString, - Description: "The working directory path to be used by a Terragrunt template. If left empty '/' is used.", + Description: "The working directory path to be used by a Terragrunt template. If left empty '/' is used. Note: modifying this field destroys the current environment and creates a new one", + ForceNew: true, Optional: true, }, "vcs_commands_alias": { @@ -657,7 +658,7 @@ func shouldDeploy(d *schema.ResourceData) bool { } func shouldUpdate(d *schema.ResourceData) bool { - return d.HasChanges("name", "approve_plan_automatically", "deploy_on_push", "run_plan_on_pull_requests", "auto_deploy_by_custom_glob", "auto_deploy_on_path_changes_only", "terragrunt_working_directory", "vcs_commands_alias", "is_remote_backend", "is_inactive", "is_remote_apply_enabled") + return d.HasChanges("name", "approve_plan_automatically", "deploy_on_push", "run_plan_on_pull_requests", "auto_deploy_by_custom_glob", "auto_deploy_on_path_changes_only", "vcs_commands_alias", "is_remote_backend", "is_inactive", "is_remote_apply_enabled") } func shouldUpdateTTL(d *schema.ResourceData) bool { diff --git a/env0/resource_environment_test.go b/env0/resource_environment_test.go index 70af351a..a3f4664c 100644 --- a/env0/resource_environment_test.go +++ b/env0/resource_environment_test.go @@ -55,7 +55,7 @@ func TestUnitEnvironmentResource(t *testing.T) { BlueprintRevision: "revision", Output: []byte(`{"a": "b"}`), }, - TerragruntWorkingDirectory: "/terragrunt/directory2/", + TerragruntWorkingDirectory: "/terragrunt/directory/", VcsCommandsAlias: "alias2", IsRemoteBackend: &isRemoteBackendTrue, IsArchived: boolPtr(true),