lib/chef/knife/ec2_server_create.rb in knife-ec2-1.0.16 vs lib/chef/knife/ec2_server_create.rb in knife-ec2-1.0.17
- old
+ new
@@ -276,11 +276,10 @@
}
option :cpu_credits,
long: "--cpu-credits CPU_CREDITS",
description: "The credit option for CPU usage of the instance. Valid values are standard and unlimited. T3 instances launch as unlimited by default. T2 instances launch as standard by default.",
- default: "standard",
in: %w{standard unlimited}
def plugin_create_instance!
requested_elastic_ip = config[:associate_eip] if config[:associate_eip]
@@ -982,13 +981,15 @@
## cannot pass disable_api_termination option to the API when using spot instances ##
attributes[:disable_api_termination] = config_value(:disable_api_termination) if config_value(:spot_price).nil?
attributes[:instance_initiated_shutdown_behavior] = config_value(:instance_initiated_shutdown_behavior)
- attributes[:credit_specification] =
- {
- cpu_credits: config[:cpu_credits],
- }
+ if config[:cpu_credits]
+ attributes[:credit_specification] =
+ {
+ cpu_credits: config[:cpu_credits],
+ }
+ end
attributes
end
def create_ec2_instance(attributes)
ec2_connection.run_instances(attributes)