Skip to content

Commit

Permalink
hashicorp#13605 added base64decode string before sending to aws-sdk-g…
Browse files Browse the repository at this point in the history
…o, so certificate_wallet is not encoded twice
  • Loading branch information
sonikro committed Mar 5, 2021
1 parent 495f51a commit ed3e6cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/13605.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_dms_certificate: Add base64 decode before sending to aws-sdk-go, so oracle-wallet is not encoded twice
```
7 changes: 6 additions & 1 deletion aws/resource_aws_dms_certificate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package aws

import (
"encoding/base64"
"fmt"
"log"

Expand Down Expand Up @@ -72,7 +73,11 @@ func resourceAwsDmsCertificateCreate(d *schema.ResourceData, meta interface{}) e
request.CertificatePem = aws.String(pem.(string))
}
if walletSet {
request.CertificateWallet = []byte(wallet.(string))
byteArray, err := base64.StdEncoding.DecodeString(wallet.(string))
if err != nil {
return fmt.Errorf("certificate_wallet is not a valid base64-encoded string")
}
request.CertificateWallet = byteArray
}

log.Println("[DEBUG] DMS import certificate:", request)
Expand Down

0 comments on commit ed3e6cb

Please sign in to comment.