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

amazon.aws.aws_secret lookup with bypath=true returns only upto 10 values #472

Closed
1 task done
ggrzesiuk opened this issue Aug 25, 2021 · 5 comments · Fixed by #591
Closed
1 task done

amazon.aws.aws_secret lookup with bypath=true returns only upto 10 values #472

ggrzesiuk opened this issue Aug 25, 2021 · 5 comments · Fixed by #591
Assignees
Labels
bug This issue/PR relates to a bug easyfix Good for new comers and easy to start with contribution has_pr jira python3 waiting_on_contributor Needs help. Feel free to engage to get things unblocked

Comments

@ggrzesiuk
Copy link

ggrzesiuk commented Aug 25, 2021

Summary

I found an issue when using ansible lookup plugin. In my ansible playbook ( Ansible 2.10) I'm using lookup plugin to get all secrets from AWS Secrets Manager with the bypath attribute.

vars: 
#which environment: dev, test,uat, prd 
my_env: dev 
aws_secret_path: mypath/{{my_env}}

name: "get all secrets from AWS Secrets Manager" 
  set_fact: secret_value: "{{ lookup('amazon.aws.aws_secret', '{{aws_secret_path}}', on_missing='skip', bypath='true', region='eu-west-1' )}}"

It is working fine however I realized that it returns only up to 10 elements.
Is there a way to return all elements or use pagination ? Have you faced similar issue with lookup plugin ?

Issue Type

Bug Report

Component Name

amazon.aws.aws_secret

Ansible Version

 ansible --version
ansible 2.10.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/var/lib/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /venv/awx-venv/lib64/python3.6/site-packages/ansible
  executable location = /venv/awx-venv/bin/ansible
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

Collection Versions

Collection        Version
----------------- -------
amazon.aws        1.5.0  
community.aws     1.4.0  
community.general 2.3.0 

AWS SDK versions

(awx-venv) bash-4.4$ pip show boto boto3 botocore
Name: boto
Version: 2.49.0
Summary: Amazon Web Services Library
Home-page: https://github.com/boto/boto/
Author: Mitch Garnaat
Author-email: [email protected]
License: MIT
Location: /venv/awx-venv/lib/python3.6/site-packages
Requires: 
Required-by: 
---
Name: boto3
Version: 1.17.46
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /venv/awx-venv/lib/python3.6/site-packages
Requires: botocore, jmespath, s3transfer
Required-by: 
---
Name: botocore
Version: 1.20.46
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /venv/awx-venv/lib/python3.6/site-packages
Requires: python-dateutil, jmespath, urllib3
Required-by: s3transfer, boto3

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

vars: 
#which environment: dev, test,uat, prd 
my_env: dev 
aws_secret_path: mypath/{{my_env}}

name: "get all secrets from AWS Secrets Manager" 
  set_fact: secret_value: "{{ lookup('amazon.aws.aws_secret', '{{aws_secret_path}}', on_missing='skip', bypath='true', region='eu-west-1' )}}"

Expected Results

Lookup plugin should return all secrets from AWS Secret Manager

Actual Results

It returns only up tp 10 results

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added bug This issue/PR relates to a bug needs_triage python3 labels Aug 25, 2021
alinabuzachis added a commit that referenced this issue Aug 25, 2021
* ec2_vpc_nat_gateway_info: stability
	* Catches and handles (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) on boto API calls
	* Add paginator
	* Document returned data

Signed-off-by: Alina Buzachis <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@b0f438b
alinabuzachis added a commit that referenced this issue Aug 25, 2021
* ec2_vpc_nat_gateway_info: stability
	* Catches and handles (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) on boto API calls
	* Add paginator
	* Document returned data

Signed-off-by: Alina Buzachis <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@b0f438b
alinabuzachis added a commit that referenced this issue Aug 26, 2021
* ec2_vpc_nat_gateway_info: stability
	* Catches and handles (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) on boto API calls
	* Add paginator
	* Document returned data

Signed-off-by: Alina Buzachis <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@b0f438b
@ggrzesiuk
Copy link
Author

ggrzesiuk commented Aug 26, 2021

As sugested by mdaniel on Stackoverflow It seems you are ignoring the advice to honor NextToken -
as described here Kindly please implement it as it doesn't allow to fetch more than 10 records from AWS Secrets Manager

alinabuzachis added a commit that referenced this issue Aug 26, 2021
* ec2_vpc_nat_gateway_info: stability
	* Catches and handles (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) on boto API calls
	* Add paginator
	* Document returned data

Signed-off-by: Alina Buzachis <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@b0f438b
alinabuzachis added a commit to alinabuzachis/amazon.aws that referenced this issue Aug 26, 2021
* ec2_vpc_nat_gateway_info: stability
	* Catches and handles (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) on boto API calls
	* Add paginator
	* Document returned data

Signed-off-by: Alina Buzachis <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@b0f438b
jillr pushed a commit to alinabuzachis/amazon.aws that referenced this issue Aug 27, 2021
* ec2_vpc_nat_gateway_info: stability
	* Catches and handles (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) on boto API calls
	* Add paginator
	* Document returned data

Signed-off-by: Alina Buzachis <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@b0f438b
@goneri goneri added waiting_on_contributor Needs help. Feel free to engage to get things unblocked easyfix Good for new comers and easy to start with contribution and removed needs_triage labels Aug 31, 2021
@ggrzesiuk
Copy link
Author

hi! any update on this issue ? Would good if that could be fixed.
Thanks!
Greg

@mandar242 mandar242 self-assigned this Dec 20, 2021
@abikouo abikouo removed the waiting_on_contributor Needs help. Feel free to engage to get things unblocked label Jan 10, 2022
@mandar242
Copy link
Contributor

hi! any update on this issue ? Would good if that could be fixed. Thanks! Greg

Hi Greg, can you please try with this patch #591?

@ggrzesiuk
Copy link
Author

ggrzesiuk commented Jan 18, 2022 via email

@ansibullbot ansibullbot added has_pr waiting_on_contributor Needs help. Feel free to engage to get things unblocked labels Jan 27, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 1, 2022
aws_secret: Handle pagination for bypath=true

Depends-On: ansible/ansible-zuul-jobs#1359
Depends-On: ansible/ansible-zuul-jobs#1362
Depends-On: ansible/ansible-zuul-jobs#1364
SUMMARY

Currently aws_secret returns only 10 secrets, added manual pagination for getting all the secrets as per the task.
Fixes #472.
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

aws_secret

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Joseph Torcasso <None>
patchback bot pushed a commit that referenced this issue Mar 1, 2022
aws_secret: Handle pagination for bypath=true

Depends-On: ansible/ansible-zuul-jobs#1359
Depends-On: ansible/ansible-zuul-jobs#1362
Depends-On: ansible/ansible-zuul-jobs#1364
SUMMARY

Currently aws_secret returns only 10 secrets, added manual pagination for getting all the secrets as per the task.
Fixes #472.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

aws_secret

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Joseph Torcasso <None>
(cherry picked from commit 9f0a616)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 2, 2022
[PR #591/9f0a616e backport][stable-3] aws_secret: Handle pagination for bypath=true

This is a backport of PR #591 as merged into main (9f0a616).
Depends-On: ansible/ansible-zuul-jobs#1359
Depends-On: ansible/ansible-zuul-jobs#1362
Depends-On: ansible/ansible-zuul-jobs#1364
SUMMARY

Currently aws_secret returns only 10 secrets, added manual pagination for getting all the secrets as per the task.
Fixes #472.
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

aws_secret
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
* ec2_vpc_nat_gateway_info: stability
	* Catches and handles (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) on boto API calls
	* Add paginator
	* Document returned data

Signed-off-by: Alina Buzachis <[email protected]>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
* ec2_vpc_nat_gateway_info: stability
	* Catches and handles (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) on boto API calls
	* Add paginator
	* Document returned data

Signed-off-by: Alina Buzachis <[email protected]>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
* ec2_vpc_nat_gateway_info: stability
	* Catches and handles (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) on boto API calls
	* Add paginator
	* Document returned data

Signed-off-by: Alina Buzachis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug easyfix Good for new comers and easy to start with contribution has_pr jira python3 waiting_on_contributor Needs help. Feel free to engage to get things unblocked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants