From 89d09bae21e22374af7fcaf39c189233621e7ed2 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Tue, 10 Oct 2017 13:15:11 -0400 Subject: [PATCH] [cloud] Fix ec2_group when security group lacks a VPC (#31526) --- lib/ansible/modules/cloud/amazon/ec2_group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_group.py b/lib/ansible/modules/cloud/amazon/ec2_group.py index c8a74e8640..a7656b3301 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_group.py +++ b/lib/ansible/modules/cloud/amazon/ec2_group.py @@ -657,7 +657,7 @@ def main(): if group_id and sg['GroupId'] == group_id: group = sg - elif groupName == name and (vpc_id is None or sg['VpcId'] == vpc_id): + elif groupName == name and (vpc_id is None or sg.get('VpcId') == vpc_id): group = sg # Ensure requested group is absent