diff --git a/lib/kitchen/driver/aws/instance_generator.rb b/lib/kitchen/driver/aws/instance_generator.rb index 47c16183..c99b6a7b 100644 --- a/lib/kitchen/driver/aws/instance_generator.rb +++ b/lib/kitchen/driver/aws/instance_generator.rb @@ -64,6 +64,11 @@ def ec2_instance_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize :device_index => 0, :associate_public_ip_address => config[:associate_public_ip] }] + # If specifying `:network_interfaces` in the request, you must specify the + # subnet_id in the network_interfaces block and not at the top level + if config[:subnet_id] + i[:network_interfaces][0][:subnet_id] = i.delete(:subnet_id) + end end i end