Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2_vpc_peer creates new peering connection when Accepter and Requester are reversed #580

Closed
sszwed opened this issue May 18, 2021 · 2 comments · Fixed by #1346
Closed
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type) python3

Comments

@sszwed
Copy link

sszwed commented May 18, 2021

SUMMARY

When the Requester and Accepter are reversed, the module is creating a new VPC peering connection. There is no way to accept this connection because it already exists.
The issue appeared in version 1.5.0, and before this version, it worked fine.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ec2_vpc_peer

ANSIBLE VERSION
ansible 2.10.9
  config file = /Users/x/work/repo/ansible.cfg
  configured module search path = ['/Users/x/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/x/work/repo/venv/lib/python3.9/site-packages/ansible
  executable location = /Users/x/work/repo/venv/bin/ansible
  python version = 3.9.2 (default, Mar 15 2021, 17:37:51) [Clang 12.0.0 (clang-1200.0.32.29)]
CONFIGURATION
DEFAULT_VERBOSITY(env: ANSIBLE_VERBOSITY) = 1
OS / ENVIRONMENT

My OS is MacOS Bug Sur 11.2.1

STEPS TO REPRODUCE
  • Create VPC peering connection
  • Run module with reversed Requester and Accepter

Note: Module in a version before 1.5.0 are also creating new peering connection when in AWS exists deleted connection with the order like specified in the task, so to test it, you need to request connection which doesn't have deleted connections.

- name: Request VPC peerings
  ec2_vpc_peer:
    vpc_id: "{{ vpc_id }}"
    peer_vpc_id: "{{ peer_vpc_id }}"
    peer_region: "{{ peer_region }}"
    peer_owner_id: "{{ peer_owner_id }}"
    state: present
    region: "{{ region }}"
    aws_access_key: "{{ session_credentials.access_key }}"
    aws_secret_key: "{{ session_credentials.secret_key }}"
    security_token: "{{ session_credentials.session_token }}"
  register: vpc_peerings_requested

- name: Accept VPC peering
  ec2_vpc_peer:
    peering_id: "{{ vpc_peerings_requested.peering_id }}"
    state: accept
    region: "{{ peer_region }}"
    aws_access_key: "{{ peer_credentials.access_key }}"
    aws_secret_key: "{{ peer_credentials.secret_key }}"
    security_token: "{{ peer_credentials.session_token }}"
EXPECTED RESULTS

First task is creating a peering connection, and the second task is failing because the connection already exists

ACTUAL RESULTS

All two tasks passes without any changes

@tremble
Copy link
Contributor

tremble commented Jul 11, 2022

Hi @sszwed,

Sorry it's taken so long to get back to you on this one. I've opened #1346 which should fix the issue you're seeing.

Mark

@ansibullbot
Copy link

@ansibullbot ansibullbot added bug This issue/PR relates to a bug has_pr module module plugins plugin (any type) python3 labels Jul 11, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jul 12, 2022
…1346)

ec2_vpc_peer - Fix idempotency when accepter/requester is reversed

SUMMARY
fixes: #580
Fixes a bug where a new peering request would be created when the accepter/requester is reversed
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/ec2_vpc_peer.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
patchback bot pushed a commit that referenced this issue Jul 12, 2022
…1346)

ec2_vpc_peer - Fix idempotency when accepter/requester is reversed

SUMMARY
fixes: #580
Fixes a bug where a new peering request would be created when the accepter/requester is reversed
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/ec2_vpc_peer.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
(cherry picked from commit 1c3ad28)
patchback bot pushed a commit that referenced this issue Jul 12, 2022
…1346)

ec2_vpc_peer - Fix idempotency when accepter/requester is reversed

SUMMARY
fixes: #580
Fixes a bug where a new peering request would be created when the accepter/requester is reversed
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/ec2_vpc_peer.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
(cherry picked from commit 1c3ad28)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jul 12, 2022
…1346) (#1350)

[PR #1346/1c3ad281 backport][stable-3] ec2_vpc_peer - Fix idempotency when accepter/requester is reversed

This is a backport of PR #1346 as merged into main (1c3ad28).
SUMMARY
fixes: #580
Fixes a bug where a new peering request would be created when the accepter/requester is reversed
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/ec2_vpc_peer.py
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell <None>
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jul 12, 2022
…1346) (#1351)

[PR #1346/1c3ad281 backport][stable-4] ec2_vpc_peer - Fix idempotency when accepter/requester is reversed

This is a backport of PR #1346 as merged into main (1c3ad28).
SUMMARY
fixes: #580
Fixes a bug where a new peering request would be created when the accepter/requester is reversed
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/ec2_vpc_peer.py
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type) python3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants