Skip to content

Commit 7594c09

Browse files
committed
provider/digitalocean: fix issue hashicorp#3628 by accepting SSH fingerprints
1 parent 965399c commit 7594c09

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

builtin/providers/digitalocean/resource_digitalocean_droplet.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,17 @@ func resourceDigitalOceanDropletCreate(d *schema.ResourceData, meta interface{})
140140
opts.SSHKeys = make([]godo.DropletCreateSSHKey, 0, sshKeys)
141141
for i := 0; i < sshKeys; i++ {
142142
key := fmt.Sprintf("ssh_keys.%d", i)
143-
id, err := strconv.Atoi(d.Get(key).(string))
144-
if err != nil {
145-
return err
143+
sshKeyRef := d.Get(key).(string)
144+
145+
var sshKey godo.DropletCreateSSHKey
146+
// sshKeyRef can be either an ID or a fingerprint
147+
if id, err := strconv.Atoi(sshKeyRef); err == nil {
148+
sshKey.ID = id
149+
} else {
150+
sshKey.Fingerprint = sshKeyRef
146151
}
147152

148-
opts.SSHKeys = append(opts.SSHKeys, godo.DropletCreateSSHKey{
149-
ID: id,
150-
})
153+
opts.SSHKeys = append(opts.SSHKeys, sshKey)
151154
}
152155
}
153156

0 commit comments

Comments
 (0)