Skip to content

Commit fe55da0

Browse files
committed
Add support for specifying the SSH key type to be automatically generated
AL2022+ is based on Fedora 35 which only supports ed25519 out of the box
1 parent 4feff98 commit fe55da0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/kitchen/driver/ec2.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class Ec2 < Kitchen::Driver::Base
7878
default_config :aws_secret_access_key, nil
7979
default_config :aws_session_token, nil
8080
default_config :aws_ssh_key_id, ENV["AWS_SSH_KEY_ID"]
81+
default_config :aws_ssh_key_type, "rsa"
8182
default_config :image_id, &:default_ami
8283
default_config :image_search, nil
8384
default_config :username, nil
@@ -831,7 +832,7 @@ def create_key(state)
831832
# to rapidly exhaust local entropy by creating a lot of keys. So this is
832833
# probably fine. If you want very high security, probably don't use this
833834
# feature anyway.
834-
resp = ec2.client.create_key_pair(key_name: "kitchen-#{name_parts.join("-")}")
835+
resp = ec2.client.create_key_pair(key_name: "kitchen-#{name_parts.join("-")}", key_type: config[:aws_ssh_key_type])
835836
state[:auto_key_id] = resp.key_name
836837
info("Created automatic key pair #{state[:auto_key_id]}")
837838
# Write the key out with safe permissions

0 commit comments

Comments
 (0)