Skip to content

Commit

Permalink
ec2_lc: add volume throughput parameter support (ansible-collections#790
Browse files Browse the repository at this point in the history
)

ec2_lc: add volume throughput parameter support

SUMMARY

Adding throughput parameter support to ec2_lc.
Fixes ansible-collections#784.

ISSUE TYPE


Feature Pull Request

COMPONENT NAME

community.aws.ec2_lc
UPDATE:
Integration tests being added in a separate PR: ansible-collections#824

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Jill R <None>
  • Loading branch information
mandar242 authored Jan 25, 2022
1 parent 1198ce1 commit 4630316
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ec2_lc.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
description:
- The number of IOPS per second to provision for the volume.
- Required when I(volume_type=io1).
throughput:
type: int
description:
- The throughput to provision for a gp3 volume.
- Valid Range is a minimum value of 125 and a maximum value of 1000.
version_added: 3.1.0
encrypted:
type: bool
default: false
Expand Down Expand Up @@ -478,7 +484,7 @@ def create_block_device_meta(module, volume):
if 'no_device' in volume:
return_object['NoDevice'] = volume.get('no_device')

if any(key in volume for key in ['snapshot', 'volume_size', 'volume_type', 'delete_on_termination', 'iops', 'encrypted']):
if any(key in volume for key in ['snapshot', 'volume_size', 'volume_type', 'delete_on_termination', 'iops', 'throughput', 'encrypted']):
return_object['Ebs'] = {}

if 'snapshot' in volume:
Expand All @@ -496,6 +502,11 @@ def create_block_device_meta(module, volume):
if 'iops' in volume:
return_object['Ebs']['Iops'] = volume.get('iops')

if 'throughput' in volume:
if volume.get('volume_type') != 'gp3':
module.fail_json(msg='The throughput parameter is supported only for GP3 volumes.')
return_object['Ebs']['Throughput'] = volume.get('throughput')

if 'encrypted' in volume:
return_object['Ebs']['Encrypted'] = volume.get('encrypted')

Expand Down

0 comments on commit 4630316

Please sign in to comment.