diff --git a/changelogs/fragments/62290-fix-cloudformation_info-KeyError.yaml b/changelogs/fragments/62290-fix-cloudformation_info-KeyError.yaml new file mode 100644 index 0000000000..6222b1bb30 --- /dev/null +++ b/changelogs/fragments/62290-fix-cloudformation_info-KeyError.yaml @@ -0,0 +1,2 @@ +bugfixes: + - cloudformation_info - Fix a KeyError returning information about the stack(s). diff --git a/lib/ansible/modules/cloud/amazon/cloudformation_info.py b/lib/ansible/modules/cloud/amazon/cloudformation_info.py index d3a1a62834..600470b317 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation_info.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation_info.py @@ -295,7 +295,10 @@ def main(): service_mgr = CloudFormationServiceManager(module) - result = {'ansible_facts': {'cloudformation': {}}} + if is_old_facts: + result = {'ansible_facts': {'cloudformation': {}}} + else: + result = {'cloudformation': {}} for stack_description in service_mgr.describe_stacks(module.params.get('stack_name')): facts = {'stack_description': stack_description}