Skip to content

Commit

Permalink
eks_nodegroup - fixing remote access and added to integration tests (a…
Browse files Browse the repository at this point in the history
…nsible-collections#1773)

eks_nodegroup - fixing remote access and added to integration tests

SUMMARY
Fixes ansible-collections#1771
Handling remote_access configuration the right way that boto understands it. Also included it to integration tests.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
eks_nodegroup

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Thomas Bruckmann
Reviewed-by: Mark Chappell
  • Loading branch information
romulus-ai authored and tremble committed Apr 20, 2023
1 parent 2fe39ba commit 644cd58
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/1771-remote-access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- eks_nodegroup - fix parameter options of ``remote_access`` (https://github.com/ansible-collections/community.aws/issues/1771).
6 changes: 5 additions & 1 deletion plugins/modules/eks_nodegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,11 @@ def create_or_update_nodegroups(client, module):
if module.params['release_version'] is not None:
params['releaseVersion'] = module.params['release_version']
if module.params['remote_access'] is not None:
params['remoteAccess'] = module.params['remote_access']
params['remoteAccess'] = dict()
if module.params['remote_access']['ec2_ssh_key'] is not None:
params['remoteAccess']['ec2SshKey'] = module.params['remote_access']['ec2_ssh_key']
if module.params['remote_access']['source_sg'] is not None:
params['remoteAccess']['sourceSecurityGroups'] = module.params['remote_access']['source_sg']
if module.params['capacity_type'] is not None:
params['capacityType'] = module.params['capacity_type'].upper()
if module.params['labels'] is not None:
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/targets/eks_nodegroup/tasks/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
with_items: '{{ eks_security_groups|reverse|list + additional_eks_sg }}'
ignore_errors: 'yes'

- name: Delete securitygroup for node access
amazon.aws.ec2_security_group:
name: 'ansible-test-eks_nodegroup'
description: "SSH access"
vpc_id: '{{ setup_vpc.vpc.id }}'
rules: []
state: absent

- name: Delete Keypair for Access to Nodegroup nodes
amazon.aws.ec2_key:
name: "ansible-test-eks_nodegroup"
state: absent

- name: remove Route Tables
ec2_vpc_route_table:
state: absent
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/targets/eks_nodegroup/tasks/dependecies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,20 @@
default_version: 1
instance_type: t3.micro
register: lt

- name: Create securitygroup for node access
amazon.aws.ec2_security_group:
name: 'ansible-test-eks_nodegroup'
description: "SSH access"
vpc_id: '{{ setup_vpc.vpc.id }}'
rules:
- proto: tcp
ports:
- 22
cidr_ip: 0.0.0.0/0
register: securitygroup_eks_nodegroup

- name: Create Keypair for Access to Nodegroup nodes
amazon.aws.ec2_key:
name: "ansible-test-eks_nodegroup"
register: ec2_key_eks_nodegroup
32 changes: 32 additions & 0 deletions tests/integration/targets/eks_nodegroup/tasks/full_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -114,6 +118,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result

Expand Down Expand Up @@ -147,6 +155,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -181,6 +193,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -255,6 +271,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -289,6 +309,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result

Expand Down Expand Up @@ -322,6 +346,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -356,6 +384,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result

Expand Down

0 comments on commit 644cd58

Please sign in to comment.