From 255764f14a803b4cb4aa9f3560b42cdbe2b3432a Mon Sep 17 00:00:00 2001 From: Naman Goenka Date: Sun, 17 Nov 2024 19:54:35 +0530 Subject: [PATCH] fix: [CDS-101017]: fix unsaved changes in plan for snow url without slash (#1115) --- .changelog/1115.txt | 3 +++ internal/service/platform/connector/service_now.go | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 .changelog/1115.txt diff --git a/.changelog/1115.txt b/.changelog/1115.txt new file mode 100644 index 000000000..e5454d77f --- /dev/null +++ b/.changelog/1115.txt @@ -0,0 +1,3 @@ +```relese-note:fix +harness_platform_connector_service_now: omit difference of slash in service_now_url +``` \ No newline at end of file diff --git a/internal/service/platform/connector/service_now.go b/internal/service/platform/connector/service_now.go index 4c7f9ca3e..c6524d23a 100644 --- a/internal/service/platform/connector/service_now.go +++ b/internal/service/platform/connector/service_now.go @@ -2,6 +2,7 @@ package connector import ( "context" + "strings" "github.com/harness/harness-go-sdk/harness/nextgen" "github.com/harness/terraform-provider-harness/helpers" @@ -25,6 +26,11 @@ func ResourceConnectorServiceNow() *schema.Resource { Description: "URL of service now.", Type: schema.TypeString, Required: true, + // Suppress the diff shown if the service_now_url are equal when both compared after removing / suffix if present. + // API implementation returns url appended with / + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return strings.TrimSuffix(old, "/") == strings.TrimSuffix(new, "/") + }, }, "username": { Description: "Username to use for authentication.",