lib/kitchen/driver/ec2.rb in kitchen-ec2-3.14.0 vs lib/kitchen/driver/ec2.rb in kitchen-ec2-3.15.0
- old
+ new
@@ -29,10 +29,11 @@
require_relative "aws/standard_platform/centos"
require_relative "aws/standard_platform/debian"
require_relative "aws/standard_platform/rhel"
require_relative "aws/standard_platform/fedora"
require_relative "aws/standard_platform/freebsd"
+require_relative "aws/standard_platform/macos"
require_relative "aws/standard_platform/ubuntu"
require_relative "aws/standard_platform/windows"
require "aws-sdk-ec2"
require "aws-sdk-core/waiters/errors"
require "retryable" unless defined?(Retryable)
@@ -77,10 +78,11 @@
default_config :retryable_sleep, 5
default_config :aws_access_key_id, nil
default_config :aws_secret_access_key, nil
default_config :aws_session_token, nil
default_config :aws_ssh_key_id, ENV["AWS_SSH_KEY_ID"]
+ default_config :aws_ssh_key_type, "rsa"
default_config :image_id, &:default_ami
default_config :image_search, nil
default_config :username, nil
default_config :associate_public_ip, nil
default_config :interface, nil
@@ -851,10 +853,10 @@
# In a perfect world this would generate the key locally and use ImportKey
# instead for better security, but given the use case that is very likely
# to rapidly exhaust local entropy by creating a lot of keys. So this is
# probably fine. If you want very high security, probably don't use this
# feature anyway.
- resp = ec2.client.create_key_pair(key_name: "kitchen-#{name_parts.join("-")}")
+ resp = ec2.client.create_key_pair(key_name: "kitchen-#{name_parts.join("-")}", key_type: config[:aws_ssh_key_type])
state[:auto_key_id] = resp.key_name
info("Created automatic key pair #{state[:auto_key_id]}")
# Write the key out with safe permissions
key_path = "#{config[:kitchen_root]}/.kitchen/#{instance.name}.pem"
File.open(key_path, File::WRONLY | File::CREAT | File::EXCL, 00600) do |f|