forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ec2_group for numbered protocols (GRE) (ansible#42765)
* Fix spurious `changed=True` when int is passed as tag * Fix for all AWS module using compare_aws_tags * Handle improperly stringified protocols and allow inconsistency between None/-1 on non-tcp protocols * Add integration test that reproduces the same bug * Return false if the comparsison is not equal
- Loading branch information
Showing
4 changed files
with
101 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
71 changes: 71 additions & 0 deletions
71
test/integration/targets/ec2_group/tasks/numeric_protos.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
- block: | ||
- name: set up aws connection info | ||
set_fact: | ||
group_tmp_name: '{{ec2_group_name}}-numbered-protos' | ||
aws_connection_info: &aws_connection_info | ||
aws_access_key: "{{ aws_access_key }}" | ||
aws_secret_key: "{{ aws_secret_key }}" | ||
security_token: "{{ security_token }}" | ||
region: "{{ aws_region }}" | ||
no_log: yes | ||
|
||
- name: Create a group with numbered protocol (GRE) | ||
ec2_group: | ||
name: '{{ group_tmp_name }}' | ||
vpc_id: '{{ vpc_result.vpc.id }}' | ||
description: '{{ ec2_group_description }}' | ||
rules: | ||
- proto: 47 | ||
to_port: -1 | ||
from_port: -1 | ||
cidr_ip: 0.0.0.0/0 | ||
<<: *aws_connection_info | ||
state: present | ||
register: result | ||
|
||
- name: Create a group with a quoted proto | ||
ec2_group: | ||
name: '{{ group_tmp_name }}' | ||
vpc_id: '{{ vpc_result.vpc.id }}' | ||
description: '{{ ec2_group_description }}' | ||
rules: | ||
- proto: '47' | ||
to_port: -1 | ||
from_port: -1 | ||
cidr_ip: 0.0.0.0/0 | ||
<<: *aws_connection_info | ||
state: present | ||
register: result | ||
- assert: | ||
that: | ||
- result is not changed | ||
- name: Add a tag with a numeric value | ||
ec2_group: | ||
name: '{{ group_tmp_name }}' | ||
vpc_id: '{{ vpc_result.vpc.id }}' | ||
description: '{{ ec2_group_description }}' | ||
tags: | ||
foo: 1 | ||
<<: *aws_connection_info | ||
- name: Read a tag with a numeric value | ||
ec2_group: | ||
name: '{{ group_tmp_name }}' | ||
vpc_id: '{{ vpc_result.vpc.id }}' | ||
description: '{{ ec2_group_description }}' | ||
tags: | ||
foo: 1 | ||
<<: *aws_connection_info | ||
register: result | ||
- assert: | ||
that: | ||
- result is not changed | ||
|
||
always: | ||
- name: tidy up egress rule test security group | ||
ec2_group: | ||
name: '{{group_tmp_name}}' | ||
state: absent | ||
vpc_id: '{{ vpc_result.vpc.id }}' | ||
<<: *aws_connection_info | ||
ignore_errors: yes |