Skip to content

Commit

Permalink
Merge pull request #19944 from cmeichel-treezor/main
Browse files Browse the repository at this point in the history
fix aws_kms_public_key.public_key format - must be base64
  • Loading branch information
anGie44 committed Aug 25, 2021
2 parents 8c263a6 + 4ef8dae commit a99fcfb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/19944.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
data-source/aws_kms_public_key: Correctly base64 encode `public_key` value
```
3 changes: 2 additions & 1 deletion aws/data_source_aws_kms_public_key.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package aws

import (
"encoding/base64"
"fmt"

"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -75,7 +76,7 @@ func dataSourceAwsKmsPublicKeyRead(d *schema.ResourceData, meta interface{}) err
d.Set("arn", output.KeyId)
d.Set("customer_master_key_spec", output.CustomerMasterKeySpec)
d.Set("key_usage", output.KeyUsage)
d.Set("public_key", string(output.PublicKey))
d.Set("public_key", base64.StdEncoding.EncodeToString(output.PublicKey))

if err := d.Set("encryption_algorithms", flattenStringList(output.EncryptionAlgorithms)); err != nil {
return fmt.Errorf("error setting encryption_algorithms: %w", err)
Expand Down

0 comments on commit a99fcfb

Please sign in to comment.