Skip to content

Commit

Permalink
Merge pull request #4 from invidian/fixes
Browse files Browse the repository at this point in the history
Various fixes and new release
  • Loading branch information
invidian committed Jun 19, 2019
2 parents f874ede + fd764c5 commit 1a4a8a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.2.1 (June 20, 2019)

* fix gpg_encrypted_message updates issue with Terraform 0.12.x
* use sensitive for content field to make sure it does not leak
* drop using SchemaStateFunc for result, as it has no effect with Terraform 0.12.x
* make gpg_encrypted_message resource use sha256 of content as ID

## 0.2.0 (June 15, 2019)

* Add Terraform 0.12 compatibility
Expand Down
12 changes: 7 additions & 5 deletions gpg/resource_gpg_encrypted_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ func resourceGPGEncryptedMessage() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Sensitive: true,
StateFunc: sha256sum,
},
"public_keys": &schema.Schema{
Type: schema.TypeList,
MinItems: 1,
ForceNew: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
ForceNew: true,
StateFunc: func(val interface{}) string {
recipient, err := entityFromString(val.(string))
if err != nil {
Expand All @@ -49,9 +51,9 @@ func resourceGPGEncryptedMessage() *schema.Resource {
Required: true,
},
"result": &schema.Schema{
Type: schema.TypeString,
Computed: true,
StateFunc: sha256sum,
Type: schema.TypeString,
Computed: true,
ForceNew: true,
},
},
}
Expand Down Expand Up @@ -100,7 +102,7 @@ func resourceGPGEncryptedMessageCreate(d *schema.ResourceData, m interface{}) er
}

// Calculate SHA-256 checksum of message for ID
d.SetId(fmt.Sprintf("%x", sha256sum(result)))
d.SetId(sha256sum(result))

return resourceGPGEncryptedMessageRead(d, m)
}
Expand Down

0 comments on commit 1a4a8a5

Please sign in to comment.