Skip to content

Commit

Permalink
Fix encryption key issue. (#241)
Browse files Browse the repository at this point in the history
Merged PR #241.
  • Loading branch information
nat-henderson authored and modular-magician committed Jun 4, 2018
1 parent e7fb3a9 commit 1db5c4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/terraform
4 changes: 2 additions & 2 deletions templates/terraform/constants/disk.erb
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ func diskEncryptionKeyDiffSuppress(k, old, new string, d *schema.ResourceData) b
}
} else if strings.HasSuffix(k, "raw_key") {
disk_key := d.Get("disk_encryption_key_raw").(string)
return disk_key == old
return disk_key == old && old != "" && new == ""
} else if k == "disk_encryption_key_raw" {
disk_key := d.Get("disk_encryption_key.0.raw_key").(string)
return disk_key == old
return disk_key == old && old != "" && new == ""
}
return false
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *
<% if property.name == "diskEncryptionKey" -%>
} else {
// Check alternative setting?
if altV, ok := d.GetOk("disk_encryption_key_raw"); ok {
if altV, ok := d.GetOk("disk_encryption_key_raw"); ok && altV != "" {
outMap := make(map[string]interface{})
outMap["rawKey"] = altV
req = append(req, outMap)
Expand Down

0 comments on commit 1db5c4d

Please sign in to comment.