Skip to content

Commit

Permalink
inventory plugins - Hard code fall-back region to connect to when try…
Browse files Browse the repository at this point in the history
…ing to pull a list of regions
  • Loading branch information
tremble committed May 16, 2023
1 parent 6a6d41b commit 58e0652
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/1551-ec2_inventory-no-region.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- aws_ec2 inventory plugin - fix ``NoRegionError`` when no regions are provided and region isn't specified (https://github.com/ansible-collections/amazon.aws/issues/1551).
3 changes: 2 additions & 1 deletion plugins/plugin_utils/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def _set_frozen_credentials(self):
def _describe_regions(self, service):
# Try pulling a list of regions from the service
try:
client = self.client(service)
initial_region = self.region or "us-east-1"
client = self.client(service, region=initial_region)
resp = client.describe_regions()
except AttributeError:
# Not all clients support describe
Expand Down

0 comments on commit 58e0652

Please sign in to comment.