Skip to content

Commit

Permalink
fix issue ansible-collections#343 for missing AWS_SESSION_TOKEN (ansi…
Browse files Browse the repository at this point in the history
…ble-collections#535)

* fix issue ansible-collections#343 for missing AWS_SESSION_TOKEN
  • Loading branch information
ru-rocker authored Apr 9, 2021
1 parent faa7d64 commit 8b9ee85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/535-aws-ssm-session-token-missing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- aws_ssm - enable aws ssm connections if **AWS_SESSION_TOKEN** is missing (https://github.com/ansible-collections/community.aws/pull/535).
6 changes: 5 additions & 1 deletion plugins/connection/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,14 @@ def _get_boto_client(self, service, region_name=None):
aws_access_key_id = self.get_option('access_key_id')
aws_secret_access_key = self.get_option('secret_access_key')
aws_session_token = self.get_option('session_token')
if aws_access_key_id is None or aws_secret_access_key is None or aws_session_token is None:

if aws_access_key_id is None:
aws_access_key_id = os.environ.get("AWS_ACCESS_KEY_ID", None)
if aws_secret_access_key is None:
aws_secret_access_key = os.environ.get("AWS_SECRET_ACCESS_KEY", None)
if aws_session_token is None:
aws_session_token = os.environ.get("AWS_SESSION_TOKEN", None)

client = boto3.client(
service,
aws_access_key_id=aws_access_key_id,
Expand Down

0 comments on commit 8b9ee85

Please sign in to comment.