Skip to content

Commit 1769bd0

Browse files
authored
Merge pull request #1 from LaurenceGA/session-token
Use AWS session token when available
2 parents d5cbc4e + 38e55e2 commit 1769bd0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
## Environment Variables
44
#### AWS_ACCESS_KEY_ID
55
- Required: ***True***
6-
- Description: Access Key ID of the user being rotated. You can use `${{secrets.ACCESS_KEY_ID}}`
6+
- Description: Access Key ID to authenticate with AWS. You can use `${{secrets.ACCESS_KEY_ID}}`
77

88
#### AWS_SECRET_ACCESS_KEY
99
- Required: ***True***
10-
- Description: Secret Access Key ID of the user being rotated. You can use `${{secrets.SECRET_ACCESS_KEY_ID}}`
10+
- Description: Secret Access Key ID to authenticate with AWS. You can use `${{secrets.SECRET_ACCESS_KEY_ID}}`
11+
12+
#### AWS_SESSION_TOKEN
13+
- Required: ***False***
14+
- Description: Session Token for the current AWS session. Only required if you assume a role first.
1115

1216
#### IAM_USERNAME
1317
- Required: ***True***

rotate_keys.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
iam = boto3.client(
1818
'iam',
1919
aws_access_key_id = os.environ['AWS_ACCESS_KEY_ID'],
20-
aws_secret_access_key = os.environ['AWS_SECRET_ACCESS_KEY']
20+
aws_secret_access_key = os.environ['AWS_SECRET_ACCESS_KEY'],
21+
aws_session_token = os.environ['AWS_SESSION_TOKEN'] if 'AWS_SESSION_TOKEN' in os.environ else None
2122
)
2223

2324
def main_function():
@@ -134,4 +135,4 @@ def upload_secret(owner_repo,key_name,encrypted_value,pub_key_id,github_token):
134135
sys.exit(1)
135136

136137
# run everything
137-
main_function()
138+
main_function()

0 commit comments

Comments
 (0)