-
Notifications
You must be signed in to change notification settings - Fork 188
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
STS cross-account access #64
STS cross-account access #64
Conversation
Not sure the best way to fix the error. It's a single issue with a docstring. It reads: def connect_via(self, driver):
"""
Connect to API if not already connected; set self.conn
Use STS to assume a role as another user if self.account_id has been set
:param driver: the Boto sub-module to use to call connect_to_region()
:type driver: module
""" It's not recognizing 'module' as a valid type. But that's the result of calling |
|
|
@philchristensen I definitely want to get this tested and merged, but I'm trying to give some attention to another project of mine, so it might be a little while before I can. The gist of what still needs to be done (by either you or I) for this to be merge-able is:
Thanks!!!!!!!!!!!!! |
As to the docstring error with in autoscaling.py on line 60, change In this case, our doc string will change to |
That all sounds good. I'm about to leave for vacation for a week, but I should be able to get to it before Thursday, when I leave |
|
@philchristensen ok, thanks so much. I'll try to look at this over the weekend and see if I can get Sphinx and the tests happy. Interestingly, codecov.io doesn't seem to be commenting on PRs properly, but coverage did decrease a bit. I'll look into that too. |
Sorry I haven't made any headway in the unit tests, but I realized I needed to make the TrustedAdvisor stuff use regions/accounts also. It's working properly with the latest commit. |
Sorry I've let this sit for so long, it's really inexcusable. I'm going to do some work tonight on trying to get it merged. |
It's totally excusable! But thanks for the update... |
Just for my own reference, and in case I need to call it quits for the night, the collected comments that I could find from above:
Assuming I can get all this done and run through the release checklist, I'll probably cut 0.1.3 with these fixes and push the rest of the stuff in that milestone to 0.1.4. |
I believe I've finished up the code fix-ups and unit tests; as far as I can tell, the only things left from the above list are documentation updates, and testing operation with STS, which I can't do. @philchristensen is there any chance you could pull down/install the "pr64" branch and test that it still works right with STS? |
I've confirmed that this works with STS. To do:
|
…f service classes" This reverts commit 47a0602. This refactor didn't work out. When we set self.connect_function = boto.something.some_function it becomes a bound method of ``self``, apparently. The end result is that ``self`` ALWAYS gets passed in as the first argument, and there's really no way around this. The only alternative would be to set connect_function to a string, the name of the function to call, but then testing becomes horrible and it also won't support functions *or* classes.
I went a bit too far down a rabbit hole, this is taking longer than I'd expected. As of be65975, remaining to do:
|
Current coverage is
|
…tedAdvisor doesn't have to be a subclass of _AwsService
I'm closing this in favor of #77 that pulls in my work from last night. |
Fixup of #64 - region and STS support
Fixup of #64 - region and STS support
At Logicworks we had a crucial need to look up service limits across many different client accounts, and this tool was the perfect fit. The only thing missing was a more practical way to query multiple accounts than specifying access keys via environment variables.
I was able to fairly trivially implement STS AssumeRole support, allowing you to setup your environment variables with a IAM user that has
sts:AssumeRole
privileges. The primary change was a switch to using theconnect_to_region()
function to connect to the API, which accepts the access keys and security token you get from STS.To use this in code, you should already have created an IAM account with
sts:AssumeRole
, and set your environment up up using the normal methods (env variables, config file, what have you). Then you simply pass theregion
, anaccount_id
(a 12 digit string), andaccount_role
, the name of an IAM Role defined in the destination account. Alternatively, you can use the new-r
,-A
and-R
flags to pass those things in at the CLI.I fixed the tests it broke, but I haven't yet been able to write any tests. I'm not entirely sure how. All that has changed is a line or two in the connect() methods, and there has been the addition of two methods to the _AwsService base class,
connect_via()
and_get_sts_token()
, but I'm not clear how to add tests for them without requiring use of an actual AWS account.This is a pretty useful patch, though, so I wanted to at least make it available.