[ec2] Use user_data if specified (#54494)

* Use user_data if specified

* changelog
pull/55056/head
Sloane Hertel 6 years ago committed by GitHub
parent d53c3cd4f2
commit ba8b5ec0d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
bugfixes:
- ec2 - Only use user_data if the user has specified a value.
This prevents setting the instance's user data to b'None'.

@ -1070,8 +1070,9 @@ def create_instances(module, ec2, vpc, override_count=None):
'placement': zone,
'instance_type': instance_type,
'kernel_id': kernel,
'ramdisk_id': ramdisk,
'user_data': to_bytes(user_data, errors='surrogate_or_strict')}
'ramdisk_id': ramdisk}
if user_data is not None:
params['user_data'] = to_bytes(user_data, errors='surrogate_or_strict')
if ebs_optimized:
params['ebs_optimized'] = ebs_optimized

Loading…
Cancel
Save