feat: add support for assuming a role (#17)

* first draft attempt at adding role assumption option

* refinements

* const not var

* clean up asserts

* set explicit sts endpoint and clarify required inputs error message

* streamline mocks

* add new inputs to Action definition

* ignore .idea directory

* add initial assume role test

* make tests fail usefully when not in GitHub Actions

* add logic to handle suppression of stack trace

* pull credentials exports out into function

* convert environment variable patching to use object for source and add needed members

* add test for STS call

* compartmentalization and use custom user agent in role assumption STS client

* change DO_NOT_SUPRESS_STACK_TRACE to SHOW_STACK_TRACE

* update role-to-assume input description
This commit is contained in:
Matt Bullock
2020-01-22 11:04:03 -08:00
committed by Clare Liguori
parent e3c83cfe60
commit 25960ab095
4 changed files with 277 additions and 58 deletions
+6
View File
@@ -19,6 +19,12 @@ inputs:
mask-aws-account-id:
description: "Whether to set the AWS account ID for these credentials as a secret value, so that it is masked in logs. Valid values are 'true' and 'false'. Defaults to true"
required: false
role-to-assume:
description: "Use the provided credentials to assume a Role and output the assumed credentials for that Role rather than the provided credentials"
required: false
role-duration-seconds:
description: "Role duration in seconds (default: 6 hours)"
required: false
outputs:
aws-account-id:
description: 'The AWS account ID for the provided credentials'