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

Bugfix/ec2 instance mod sgs #22

Merged
merged 10 commits into from
Aug 16, 2020
Merged

Bugfix/ec2 instance mod sgs #22

merged 10 commits into from
Aug 16, 2020

Conversation

jokajak
Copy link
Contributor

@jokajak jokajak commented Apr 3, 2020

SUMMARY

This fixes the issue below, where security groups were not changed if the instance already existed.

Fixes #21

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ec2_instance.py

ADDITIONAL INFORMATION

See ansible/ansible#67778 and ansible/ansible#55712 for previous discussions.

Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR including tests.

I think some of the logic can be simplified.

plugins/modules/ec2_instance.py Outdated Show resolved Hide resolved
plugins/modules/ec2_instance.py Outdated Show resolved Hide resolved
plugins/modules/ec2_instance.py Outdated Show resolved Hide resolved
plugins/modules/ec2_instance.py Outdated Show resolved Hide resolved
plugins/modules/ec2_instance.py Outdated Show resolved Hide resolved
plugins/modules/ec2_instance.py Outdated Show resolved Hide resolved
jokajak and others added 2 commits June 1, 2020 14:36
@jokajak jokajak marked this pull request as draft June 7, 2020 03:35
@jokajak jokajak marked this pull request as ready for review June 7, 2020 11:36
Instead of looping over the param_mapping for security groups they are
called out specifically.

Refs #21
@jillr jillr changed the base branch from master to main July 2, 2020 19:48
Copy link
Collaborator

@s-hertel s-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

default_vpc = get_default_vpc(ec2)
if default_vpc is None:
module.fail_json(
msg="No default subnet could be found - you must include a VPC subnet ID (vpc_subnet_id parameter) to create an instance")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error should probably be about modifying security groups instead of creating an instance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about the new verbiage?

@jokajak jokajak requested a review from tremble July 23, 2020 23:03
jokajak and others added 2 commits August 13, 2020 10:13
When a subnet is not defined and cannot be found generate an error
message that reflects operating on a security group.

Refs #21
@tremble
Copy link
Contributor

tremble commented Aug 16, 2020

I've added a changelog fragment but I think we're good to merge this now.

@tremble tremble merged commit 6423be5 into ansible-collections:main Aug 16, 2020
alinabuzachis pushed a commit to alinabuzachis/community.aws that referenced this pull request Jul 19, 2021
Fixes #54174

* Added SG handling for existing instances + some cleanup
* tests(ec2_instance): Tests for SG modifications to existing instances
* tests(ec2_instance): Test simultaneous state and SG changes
* refactor(ec2_instance): Move security out of for loop
* style(ec2_instance): Update fail message to reflect security groups
* Add changelog

Co-authored-by: Andrea Tartaglia <[email protected]>
Co-authored-by: Mark Chappell <[email protected]>
alinabuzachis pushed a commit to alinabuzachis/community.aws that referenced this pull request Jul 19, 2021
Fixes #54174

* Added SG handling for existing instances + some cleanup
* tests(ec2_instance): Tests for SG modifications to existing instances
* tests(ec2_instance): Test simultaneous state and SG changes
* refactor(ec2_instance): Move security out of for loop
* style(ec2_instance): Update fail message to reflect security groups
* Add changelog

Co-authored-by: Andrea Tartaglia <[email protected]>
Co-authored-by: Mark Chappell <[email protected]>
alinabuzachis pushed a commit to alinabuzachis/community.aws that referenced this pull request May 25, 2022
…tions#22)

* Change github url in galaxy.yml from git@ to https://
alinabuzachis pushed a commit to alinabuzachis/community.aws that referenced this pull request May 25, 2022
Fixes #54174

* Added SG handling for existing instances + some cleanup
* tests(ec2_instance): Tests for SG modifications to existing instances
* tests(ec2_instance): Test simultaneous state and SG changes
* refactor(ec2_instance): Move security out of for loop
* style(ec2_instance): Update fail message to reflect security groups
* Add changelog

Co-authored-by: Andrea Tartaglia <[email protected]>
Co-authored-by: Mark Chappell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ec2_instance cannot add or remove addition security groups
4 participants