From 823eeea93b0ea917091dc8635f63cce5c216a5da Mon Sep 17 00:00:00 2001 From: Erran Carey Date: Mon, 16 Apr 2018 14:56:39 +0100 Subject: [PATCH] Cherry pick changes from WeKnowSports/terraform-provider-kong@1fa3d3c22b69ec6afa6cb812851b5728f4f8d782 --- kong/resource_kong_consumer_credential_basic_auth.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kong/resource_kong_consumer_credential_basic_auth.go b/kong/resource_kong_consumer_credential_basic_auth.go index 4e14b132..4f8f2738 100644 --- a/kong/resource_kong_consumer_credential_basic_auth.go +++ b/kong/resource_kong_consumer_credential_basic_auth.go @@ -4,8 +4,11 @@ import ( "fmt" "net/http" + "crypto/sha1" "github.com/dghubble/sling" "github.com/hashicorp/terraform/helper/schema" + "io" + "strings" ) type BasicAuthCredential struct { @@ -44,6 +47,12 @@ func resourceKongBasicAuthCredential() *schema.Resource { Default: nil, Sensitive: true, Description: "The password to use in the Basic Authentication.", + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + sha1 := sha1.New() + io.WriteString(sha1, new) + io.WriteString(sha1, d.Get("consumer").(string)) + return strings.TrimSpace(old) == fmt.Sprintf("%x", sha1.Sum(nil)) + }, }, "consumer": &schema.Schema{