From 810f10d3dd23549285db7c44349937b4186ded06 Mon Sep 17 00:00:00 2001 From: Gaurav Manhas Date: Tue, 9 Dec 2025 08:12:20 +0530 Subject: [PATCH 1/3] DLPXECO-13068 Allow silent migration of toolkit_path for environments created before v4.0.0 --- internal/provider/commons.go | 2 ++ internal/provider/resource_environment.go | 32 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/internal/provider/commons.go b/internal/provider/commons.go index 84fb3d7..b5f8c5a 100644 --- a/internal/provider/commons.go +++ b/internal/provider/commons.go @@ -124,6 +124,7 @@ var updatableEnvKeys = map[string]bool{ "description": true, "tags": true, "hosts": true, + "toolkit_path": true, "ignore_tag_changes": true, } @@ -136,6 +137,7 @@ var isDestructiveEnvUpdate = map[string]bool{ "description": false, "tags": false, "hosts": true, + "toolkit_path": false, "ignore_tag_changes": false, } diff --git a/internal/provider/resource_environment.go b/internal/provider/resource_environment.go index d852873..7891ee5 100644 --- a/internal/provider/resource_environment.go +++ b/internal/provider/resource_environment.go @@ -56,6 +56,15 @@ func resourceEnvironment() *schema.Resource { "toolkit_path": { Type: schema.TypeString, Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + // Suppress diff when transitioning from any value to empty/null + // This allows silent migration from top-level toolkit_path to hosts.toolkit_path + if new == "" || new == "null" { + return true + } + // Suppress diff if both old and new are empty/null + return (old == "" || old == "null") && (new == "" || new == "null") + }, }, "username": { Type: schema.TypeString, @@ -204,6 +213,17 @@ func resourceEnvironment() *schema.Resource { Type: schema.TypeBool, Default: true, Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + // Don't suppress if user explicitly changed the value in their config + rawConfig := d.GetRawConfig() + if rawConfig.IsKnown() && !rawConfig.IsNull() { + ignoreTagChangesAttr := rawConfig.GetAttr("ignore_tag_changes") + if (ignoreTagChangesAttr.IsNull() || !ignoreTagChangesAttr.IsKnown()) && new == "true" && (old == "" || old == "null" || old == "") { + return true + } + } + return false + }, }, "tags": { Type: schema.TypeList, @@ -562,6 +582,18 @@ func resourceEnvironmentRead(ctx context.Context, d *schema.ResourceData, meta i // its an import or upgrade, set to default value d.Set("os_type", "UNIX") } + + // This handles import scenario where parameter is not in config + rawConfig := d.GetRawConfig() + if rawConfig.IsKnown() && !rawConfig.IsNull() { + ignoreTagChangesAttr := rawConfig.GetAttr("ignore_tag_changes") + if ignoreTagChangesAttr.IsNull() || !ignoreTagChangesAttr.IsKnown() { + // Parameter not in config (import scenario) - set default + d.Set("ignore_tag_changes", true) + } + } else { + d.Set("ignore_tag_changes", true) + } envRes, _ := apiRes.(*dctapi.Environment) //d.SetId(envRes.GetId()) From d6f9ab7fb0045c8c91a6a6e85a378facb1e3db20 Mon Sep 17 00:00:00 2001 From: Gaurav Manhas <86976406+gmanhas23@users.noreply.github.com> Date: Wed, 10 Dec 2025 16:27:03 +0530 Subject: [PATCH 2/3] Update .goreleaser.yml --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 4b9bb55..3f5231f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -2,7 +2,7 @@ # behavior. version: 2 env: - - PROVIDER_VERSION=4.1.0 + - PROVIDER_VERSION=4.1.1 before: hooks: # this is just an example and not a requirement for provider building/publishing From 12a0c3b8c522dc2d12416dd331c29c6ca7ada04d Mon Sep 17 00:00:00 2001 From: Gaurav Manhas <86976406+gmanhas23@users.noreply.github.com> Date: Wed, 10 Dec 2025 16:27:30 +0530 Subject: [PATCH 3/3] Update GNUmakefile --- GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index b12bb3f..4b01f57 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ HOSTNAME=delphix.com NAMESPACE=dct NAME=delphix BINARY=terraform-provider-${NAME} -VERSION=4.1.0 +VERSION=4.1.1 OS_ARCH=darwin_arm64 default: install