mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
provider/digitalocean: fix issue #3628 by accepting SSH fingerprints
This commit is contained in:
parent
965399cf45
commit
7594c09623
@ -140,14 +140,17 @@ func resourceDigitalOceanDropletCreate(d *schema.ResourceData, meta interface{})
|
|||||||
opts.SSHKeys = make([]godo.DropletCreateSSHKey, 0, sshKeys)
|
opts.SSHKeys = make([]godo.DropletCreateSSHKey, 0, sshKeys)
|
||||||
for i := 0; i < sshKeys; i++ {
|
for i := 0; i < sshKeys; i++ {
|
||||||
key := fmt.Sprintf("ssh_keys.%d", i)
|
key := fmt.Sprintf("ssh_keys.%d", i)
|
||||||
id, err := strconv.Atoi(d.Get(key).(string))
|
sshKeyRef := d.Get(key).(string)
|
||||||
if err != nil {
|
|
||||||
return err
|
var sshKey godo.DropletCreateSSHKey
|
||||||
|
// sshKeyRef can be either an ID or a fingerprint
|
||||||
|
if id, err := strconv.Atoi(sshKeyRef); err == nil {
|
||||||
|
sshKey.ID = id
|
||||||
|
} else {
|
||||||
|
sshKey.Fingerprint = sshKeyRef
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.SSHKeys = append(opts.SSHKeys, godo.DropletCreateSSHKey{
|
opts.SSHKeys = append(opts.SSHKeys, sshKey)
|
||||||
ID: id,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user