-
Notifications
You must be signed in to change notification settings - Fork 26
Multiaccount action capability #89
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
Multiaccount action capability #89
Conversation
m4dcoder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not familiar with multi-account access in AWS and so need some more explanation. The change here allows user to pass in an account_id and region when executing an AWS action. User will only need a single pair of access key and secret to be able to assume different role?
|
@m4dcoder brings up an excellent point and it really got me thinking. You generally want to do the minimum amount of work in a try:
assumed_role = self.session.client('sts').assume_role(
RoleArn=self.cross_roles_arns[account_id],
RoleSessionName='StackStormEvents'
)
except ClientError:
self.logger.error('Could not assume role on account with id: %s', account_id)
raise
try:
self.credentials.update({
'aws_access_key_id': assumed_role["Credentials"]["AccessKeyId"],
'aws_secret_access_key': assumed_role["Credentials"]["SecretAccessKey"],
'security_token': assumed_role["Credentials"]["SessionToken"]
})
except KeyError:
self.logger.error('Could not find cross region role ARN in the config file.')
raiseBut that also brings up the I would either remove the Useful log messages should:
If you can save a StackStorm administrator from having to Google for a solution, or digging through Stack Overflow posts, or querying our Slack community, they will love you (and StackStorm). |
|
@blag I understood the issue regarding the format of the try/catch block but I have to highlight that its new structure could only be: This happens because the KeyError could only be encountered if the Regarding the logging errors, I agree they could be more accurate. I will make the changes these days and hope they will meet the expectations. Until then, could you also take a look on the #87 PR which implements a similar capability for the sensor part? Thank you! |
b636c20 to
1f97258
Compare
blag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, just a few small tweaks.
1f97258 to
2f96c86
Compare
|
@blag I have squashed the new commit in the older one but I have changed the quoting style. |
blag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
2f96c86 to
00e8c6f
Compare
00e8c6f to
6efad7d
Compare
|
Closes #101. |
Fixes #70
It offers support not only for multi-region but also for multi-account actions.