mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-05 17:52:38 +00:00
SHA256 encode compute_certificate's private keys (#2976)
Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
parent
856a977ddc
commit
69e445bd59
|
@ -52,6 +52,7 @@ func resourceComputeSslCertificate() *schema.Resource {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
|
DiffSuppressFunc: sha256DiffSuppress,
|
||||||
Sensitive: true,
|
Sensitive: true,
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
package google
|
package google
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -179,6 +181,12 @@ func ipCidrRangeDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sha256DiffSuppress
|
||||||
|
// if old is the hex-encoded sha256 sum of new, treat them as equal
|
||||||
|
func sha256DiffSuppress(_, old, new string, _ *schema.ResourceData) bool {
|
||||||
|
return hex.EncodeToString(sha256.New().Sum([]byte(old))) == new
|
||||||
|
}
|
||||||
|
|
||||||
func caseDiffSuppress(_, old, new string, _ *schema.ResourceData) bool {
|
func caseDiffSuppress(_, old, new string, _ *schema.ResourceData) bool {
|
||||||
return strings.ToUpper(old) == strings.ToUpper(new)
|
return strings.ToUpper(old) == strings.ToUpper(new)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user