Summary
I have the following in my play header->
module_defaults:
group/aws:
region: "{{ aws_region | default('us-west-1') }}"
Here is an example task->
- name: grab facts for TEST_INSTANCE
ec2_instance_facts:
filters:
"tag:Name": "TEST_INSTANCE"
register: TEST_INSTANCE
I am getting this error->

Issue Type
Bug Report
Component Name
ec2_instance_facts
Ansible Version
[awx@ansible-1 ~]$ podman run 3a5db4a1de36 ansible --version
ansible [core 2.11.2]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.8.6 (default, Jan 22 2021, 11:41:28) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
jinja version = 2.10.3
libyaml = True
Collection Versions
$ ansible-galaxy collection list
[awx@ansible-1 ~]$ podman run 3a5db4a1de36 ansible-galaxy collection list
# /usr/share/ansible/collections/ansible_collections
Collection Version
------------------------ -------
amazon.aws 2.0.0
ansible.controller 4.0.0
ansible.netcommon 2.2.0
ansible.network 1.0.1
ansible.posix 1.2.0
ansible.security 1.0.0
ansible.utils 2.3.0
ansible.windows 1.5.0
arista.eos 2.2.0
cisco.asa 2.0.2
cisco.ios 2.3.0
cisco.iosxr 2.3.0
cisco.nxos 2.4.0
cloud.common 2.0.3
community.aws 2.0.0
frr.frr 1.0.3
ibm.qradar 1.0.3
junipernetworks.junos 2.2.0
kubernetes.core 2.1.1
openvswitch.openvswitch 2.0.0
redhat.insights 1.0.5
redhat.openshift 2.0.1
redhat.rhel_system_roles 1.0.1
redhat.rhv 1.4.4
redhat.satellite 2.0.1
servicenow.itsm 1.1.0
splunk.es 1.0.2
trendmicro.deepsec 1.1.0
vmware.vmware_rest 2.0.0
vyos.vyos 2.3.1
AWS SDK versions
$ pip show boto boto3 botocore
[awx@ansible-1 ~]$ podman run 3a5db4a1de36 pip show boto boto3 botocore
[dumb-init] pip: No such file or directory
[awx@ansible-1 ~]$ ansible-navigator
[awx@ansible-1 ~]$ podman run 3a5db4a1de36 pip3 show boto boto3 botocore
Name: boto
Version: 2.49.0
Summary: Amazon Web Services Library
Home-page: https://github.com/boto/boto/
Author: Mitch Garnaat
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.8/site-packages
Requires:
Required-by:
---
Name: boto3
Version: 1.17.56
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /usr/local/lib/python3.8/site-packages
Requires: botocore, s3transfer, jmespath
Required-by:
---
Name: botocore
Version: 1.20.56
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /usr/local/lib/python3.8/site-packages
Requires: urllib3, python-dateutil, jmespath
Required-by: s3transfer, boto3
Configuration
$ ansible-config dump --only-changed
OS / Environment
RHEL 8
Steps to Reproduce
---
- name: AWS ec2 de-provisioning
connection: local
hosts: localhost
gather_facts: false
# The paramater region will be set for all ec2 modules by specifying it here under module_defaults
module_defaults:
group/aws:
region: "{{ aws_region | default('us-west-1') }}"
tasks:
- name: grab facts for TEST_INSTANCE
ec2_instance_facts:
filters:
"tag:Name": "TEST_INSTANCE"
register: TEST_INSTANCE
Expected Results
No error with missing region
Actual Results
{
"msg": "The ec2_instance_facts module requires a region and none was found in configuration, environment variables or module parameters",
"invocation": {
"module_args": {
"filters": {
"tag:Name": "TEST_INSTANCE"
},
"debug_botocore_endpoint_logs": false,
"validate_certs": true,
"instance_ids": [],
"ec2_url": null,
"aws_access_key": null,
"aws_secret_key": null,
"security_token": null,
"aws_ca_bundle": null,
"profile": null,
"aws_config": null,
"region": null,
"minimum_uptime": null
}
},
"deprecations": [
{
"msg": "The 'ec2_instance_facts' module has been renamed to 'ec2_instance_info'",
"date": "2021-12-01",
"collection_name": "amazon.aws"
},
{
"msg": "Distribution rhel 8.4 on host localhost should use /usr/libexec/platform-python, but is using /usr/bin/python for backward compatibility with prior Ansible releases. A future Ansible release will default to using the discovered platform python for this host. See https://docs.ansible.com/ansible/2.11/reference_appendices/interpreter_discovery.html for more information",
"version": "2.12"
}
],
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"_ansible_no_log": false,
"changed": false
}
Code of Conduct
Summary
I have the following in my play header->
Here is an example task->
I am getting this error->

Issue Type
Bug Report
Component Name
ec2_instance_facts
Ansible Version
$ ansible --versionCollection Versions
$ ansible-galaxy collection listAWS SDK versions
$ pip show boto boto3 botocoreConfiguration
$ ansible-config dump --only-changedOS / Environment
RHEL 8
Steps to Reproduce
Expected Results
No error with missing region
Actual Results
Code of Conduct