-
Notifications
You must be signed in to change notification settings - Fork 346
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
[Manual backport] Backport pr-2488 to stable-8 #2490
Merged
softwarefactory-project-zuul
merged 1 commit into
ansible-collections:stable-8
from
mandar242:patchback/backports/stable-8/2fb1661c4fdefdf8c383a5449b55b2cbe34ad71a/pr-2488
Jan 30, 2025
Merged
[Manual backport] Backport pr-2488 to stable-8 #2490
softwarefactory-project-zuul
merged 1 commit into
ansible-collections:stable-8
from
mandar242:patchback/backports/stable-8/2fb1661c4fdefdf8c383a5449b55b2cbe34ad71a/pr-2488
Jan 30, 2025
+115
−2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…s missing from network interface (ansible-collections#2488) SUMMARY Fixes https://issues.redhat.com/browse/ACA-2123 This PR addresses an issue where module tries to attach all security groups in the region that default SGs for any VPC in the region. Causing error below fatal: [localhost]: FAILED! => {"boto3_version": "1.34.144", "botocore_version": "1.34.144", "changed": false, "msg": "Could not apply change {'Groups': ['sg-xxxx', 'sg-yyyy', 'sg-zzzz']} to existing instance.: Failed to modify instance attribute"} The subnet_id was previously passed as None when not found in the network_interface, causing failures when applying security group. The logic was updated to use module.params.get("vpc_subnet_id") when provided in task, as a fallback, preventing None from being passed to discover_security_groups() and ensuring the correct subnet is used when the default security group is specified. ISSUE TYPE Bugfix Pull Request COMPONENT NAME ec2_instance ADDITIONAL INFORMATION According to jira, the issue was introduced after 8.1.0 onwards (worked fine until and including 8.1.0) Issue was only seen (during testing/reproducing) when network and vpc_subnet_id were both specified in the task. Playbook used for testing/reproducing the issue. --- - name: EC2 instance hosts: localhost gather_facts: no vars: instance_type: "t2.micro" subnet_id: "subnet-xxxxxxx" region: "ap-northeast-2" image_id: "ami-xxxxxxx" tasks: - name: Create the EC2 instance with proper tags amazon.aws.ec2_instance: image_id: "{{ image_id }}" instance_type: "{{ instance_type }}" network: assign_public_ip: false private_ip_address: "{{ ec2_private_ip | default(omit) }}" purge_tags: false region: "{{ region }}" security_groups: "{{ security_group | default('default') }}" tags: Owner: mandkulk Persistent: False Name: xxxxx-test-instance vpc_subnet_id: "{{ subnet_id }}" wait: true state: present register: ec2 Reviewed-by: Mark Chappell Reviewed-by: Alina Buzachis (cherry picked from commit 2fb1661)
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
GomathiselviS
approved these changes
Jan 30, 2025
1ee5a9f
into
ansible-collections:stable-8
45 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Manual backport of #2488
SUMMARY
Fixes https://issues.redhat.com/browse/ACA-2123
This PR addresses an issue where module tries to attach all security groups in the region that default SGs for any VPC in the region. Causing error below
fatal: [localhost]: FAILED! => {"boto3_version": "1.34.144", "botocore_version": "1.34.144", "changed": false,
"msg": "Could not apply change {'Groups': ['sg-xxxx', 'sg-yyyy', 'sg-zzzz']} to existing instance.: Failed to modify instance attribute"}
The subnet_id was previously passed as None when not found in the network_interface, causing failures when applying security group. The logic was updated to use module.params.get("vpc_subnet_id") when provided in task, as a fallback, preventing None from being passed to discover_security_groups() and ensuring the correct subnet is used when the default security group is specified.
ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
ec2_instance
ADDITIONAL INFORMATION
According to jira, the issue was introduced after 8.1.0 onwards (worked fine until and including 8.1.0) Issue was only seen (during testing/reproducing) when network and vpc_subnet_id were both specified in the task.
Playbook used for testing/reproducing the issue.
Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis
(cherry picked from commit 2fb1661)
SUMMARY
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION