Skip to content

Commit

Permalink
Update OsProfileLinuxConfigHash generator
Browse files Browse the repository at this point in the history
Update the `resourceArmVirtualMachineScaleSetOsProfileLinuxConfigHash` method to
include in the hash function the fields from the `ssh_keys` subelements.

Fixes: hashicorp#3836
  • Loading branch information
alexsapran committed Jul 15, 2019
1 parent 83b3a59 commit 2682945
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions azurerm/resource_arm_virtual_machine_scale_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,18 @@ func resourceArmVirtualMachineScaleSetOsProfileLinuxConfigHash(v interface{}) in

if m, ok := v.(map[string]interface{}); ok {
buf.WriteString(fmt.Sprintf("%t-", m["disable_password_authentication"].(bool)))

if sshKeys, ok := m["ssh_keys"].([]interface{}); ok {
for _, item := range sshKeys {
k := item.(map[string]interface{})
if path, ok := k["path"]; ok {
buf.WriteString(fmt.Sprintf("%s-", path.(string)))
}
if data, ok := k["key_data"]; ok {
buf.WriteString(fmt.Sprintf("%s-", data.(string)))
}
}
}
}

return hashcode.String(buf.String())
Expand Down

0 comments on commit 2682945

Please sign in to comment.