Fix ec2_instance module where if placement_group and tenancy are (#63340)

both set in params, the placement_group setting is ignored.
This commit is contained in:
Geoffrey Blake 2019-11-01 12:10:07 -05:00 committed by Jill R
parent d2562cde1c
commit 7b7f15cb3a

View file

@ -1220,7 +1220,10 @@ def build_top_level_options(params):
if params.get('tenancy') is not None:
spec['Placement'] = {'Tenancy': params.get('tenancy')}
if params.get('placement_group'):
spec.setdefault('Placement', {'GroupName': str(params.get('placement_group'))})
if 'Placement' in spec:
spec['Placement']['GroupName'] = str(params.get('placement_group'))
else:
spec.setdefault('Placement', {'GroupName': str(params.get('placement_group'))})
if params.get('ebs_optimized') is not None:
spec['EbsOptimized'] = params.get('ebs_optimized')
if params.get('instance_initiated_shutdown_behavior'):