Closed matiaskorhonen closed 1 month ago
Sounds like pagination with NextToken
must be implemented here.
@matiaskorhonen do you have time to implement it?
There are already some implementations like that https://github.com/search?q=repo%3Aansible-collections%2Fcommunity.aws%20NextToken&type=code
@matiaskorhonen This will be addressed with with the refactoring of the module by #2164 and https://github.com/ansible-collections/amazon.aws/pull/2319
Summary
If there are over 200 launch template versions and the
source_version
is old enough, creating a new launch template version will fail due to the maximum number of versions that is returned by default in Boto3 (MaxResults defaults to the maximum, which is 200)Issue Type
Bug Report
Component Name
ec2_launch_template
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
The target OS is irrelevant here
Steps to Reproduce
Use the ec2_launch_template to create a new version of a launch template, repeat until there are over 200 versions of the launch template
Expected Results
The new version of the launch template should be created instead of failing
Actual Results
One the pagination limit has been reached, the version creation will fail with:
This happens even though the version does exist on AWS.
ec2.describe_launch_template_versions
only returns the last 200 versions in: https://github.com/ansible-collections/community.aws/blob/97131eca035974f41ad17357ef9bef8a0a61f675/plugins/modules/ec2_launch_template.py#L505-L507Which causes the version number validation to erroneously fail here: https://github.com/ansible-collections/community.aws/blob/97131eca035974f41ad17357ef9bef8a0a61f675/plugins/modules/ec2_launch_template.py#L633-L636
Code of Conduct