amazon.aws icon indicating copy to clipboard operation
amazon.aws copied to clipboard

ec2_vpc_net_info module : Cannot retrieve info from a VPC shared from another AWS account

Open Mogooo opened this issue 3 years ago • 2 comments

Summary

When I try to describe all of my VPCs in one AWS account where one of my VPC is a VPC shared from another account, I get the following error :

"msg": "Unable to describe if ClassicLink is enabled: An error occurred (InvalidVpcID.NotFound) when calling the DescribeVpcClassicLink operation: The vpc ID 'vpc-XXXXXXXX' does not exist"

Issue Type

Bug Report

Component Name

ec2_vpc_net_info

Ansible Version

$ ansible --version

ansible 2.9.0
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.9 (default, Dec  8 2021, 21:08:43) [GCC 8.4.0]

Collection Versions

$ ansible-galaxy collection list

AWS SDK versions

$ pip 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.6/dist-packages
Requires:
Required-by:
---
Name: boto3
Version: 1.20.51
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email:
License: Apache License 2.0
Location: /usr/local/lib/python3.6/dist-packages
Requires: botocore, jmespath, s3transfer
Required-by:
---
Name: botocore
Version: 1.23.51
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email:
License: Apache License 2.0
Location: /usr/local/lib/python3.6/dist-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: awscli, boto3, s3transfer

Configuration

$ ansible-config dump --only-changed

OS / Environment

Ubuntu 18.04

Steps to Reproduce

---
- name: Describe VPCs
  hosts: localhost
  tasks:
    - ec2_vpc_net_info:

Expected Results

I expected the module to get info from the VPC because i can still describe it with describe_vpcs

Actual Results

[WARNING]: No inventory was parsed, only implicit localhost is available

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAY [Describe VPCs] *******************************************************************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *****************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [ec2_vpc_net_info] ****************************************************************************************************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: botocore.exceptions.ClientError: An error occurred (InvalidVpcID.NotFound) when calling the DescribeVpcClassicLink operation: The vpc ID 'vpc-XXXXXXXX' does not exist
fatal: [localhost]: FAILED! => {"changed": false, "error": {"code": "InvalidVpcID.NotFound", "message": "The vpc ID 'vpc-XXXXXXXX' does not exist"}, "msg": "Unable to describe if ClassicLink is enabled: An error occurred (InvalidVpcID.NotFound) when calling the DescribeVpcClassicLink operation: The vpc ID 'vpc-XXXXXXXX' does not exist", "response_metadata": {"http_headers": {"cache-control": "no-cache, no-store", "connection": "close", "content-type": "text/xml;charset=UTF-8", "date": "Wed, 09 Feb 2022 16:49:19 GMT", "server": "AmazonEC2", "strict-transport-security": "max-age=31536000; includeSubDomains", "transfer-encoding": "chunked", "vary": "accept-encoding", "x-amzn-requestid": "XXXXXXXX"}, "http_status_code": 400, "request_id": "XXXXXXXX", "retry_attempts": 0}}

PLAY RECAP *****************************************************************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0


Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

Mogooo avatar Feb 09 '22 17:02 Mogooo

Files identified in the description:

  • [plugins/modules/ec2_vpc_net_info.py](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/ec2_vpc_net_info.py)

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Feb 09 '22 17:02 ansibullbot

cc @jillr @s-hertel @tremble @whiter click here for bot help

ansibullbot avatar Feb 09 '22 17:02 ansibullbot