Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
erran committed Apr 18, 2018
1 parent 4478f1d commit 1a0ff81
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kong/resource_kong_consumer_credential_basic_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 1a0ff81

Please sign in to comment.