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

Made changes to EFS module to allow it provision Elastic throughput m… #2263

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/2263-efs-add-elastic-throughput.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- efs - adds support for ``elastic`` parameter as a ``throughput_mode`` to ``efs`` module (https://github.com/ansible-collections/community.aws/pull/2263).
4 changes: 2 additions & 2 deletions plugins/modules/efs.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
throughput_mode:
description:
- The throughput_mode for the file system to be created.
choices: ['bursting', 'provisioned']
choices: ['bursting', 'elastic', 'provisioned']
type: str
provisioned_throughput_in_mibps:
description:
Expand Down Expand Up @@ -730,7 +730,7 @@ def main():
required=False, type="str", choices=["general_purpose", "max_io"], default="general_purpose"
),
transition_to_ia=dict(required=False, type="str", choices=["None", "7", "14", "30", "60", "90"], default=None),
throughput_mode=dict(required=False, type="str", choices=["bursting", "provisioned"], default=None),
throughput_mode=dict(required=False, type="str", choices=["bursting", "elastic", "provisioned"], default=None),
provisioned_throughput_in_mibps=dict(required=False, type="float"),
wait=dict(required=False, type="bool", default=False),
wait_timeout=dict(required=False, type="int", default=0),
Expand Down
54 changes: 54 additions & 0 deletions tests/integration/targets/efs/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,60 @@
- assert:
that: efs_result_assertions

# ============================================================
- name: Update EFS to use elastic throughput_mode
efs:
state: present
name: "{{ efs_name }}-test-efs"
tags:
Name: "{{ efs_name }}-test-tag"
Purpose: file-storage
targets:
- subnet_id: "{{testing_subnet_a.subnet.id}}"
- subnet_id: "{{testing_subnet_b.subnet.id}}"
throughput_mode: 'elastic'
register: efs_result

- assert:
that:
- efs_result is changed

# ============================================================
- name: Efs same value for throughput_mode (elastic)
efs:
state: present
name: "{{ efs_name }}-test-efs"
tags:
Name: "{{ efs_name }}-test-tag"
Purpose: file-storage
targets:
- subnet_id: "{{testing_subnet_a.subnet.id}}"
- subnet_id: "{{testing_subnet_b.subnet.id}}"
throughput_mode: 'elastic'
register: efs_result

- assert:
that:
- efs_result is not changed
- efs_result.efs["throughput_mode"] == "elastic"

# ============================================================
- name: Check new facts with elastic mode
efs_info:
name: "{{ efs_name }}-test-efs"
register: efs_result

- set_fact:
efs_result_assertions:
- efs_result is not changed
- efs_result.efs[0].throughput_mode == "elastic"
- (efs_result.efs | length) == 1
- efs_result.efs[0].creation_token == "{{ efs_name }}-test-efs"
- efs_result.efs[0].file_system_id == created_efs.efs.file_system_id

- assert:
that: efs_result_assertions

# ============================================================
# Not checking efs_result.efs["throughput_mode"] here as
# Efs with status "life_cycle_state": "updating" might return the previous values
Expand Down
Loading