Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Cross account IAM deployment #74

Merged
merged 6 commits into from
Apr 14, 2015
Merged

Cross account IAM deployment #74

merged 6 commits into from
Apr 14, 2015

Conversation

mattmb
Copy link
Contributor

@mattmb mattmb commented Apr 13, 2015

This PR adds several features:

  • It adds the ability to authenticate using cross account AWS IAM roles.
  • It adds the ability to include custom cloudformation templates.
  • It makes the deploy script runnable as a limited user.

The overall goal is that we can create an IAM user in a central AWS account which will get limited permissions by way of an included template. The user will then be able to login using the new cross account authentication. Finally the user will be able to run the salt_utils script as a limited sudoer.

This is we think cleaner than #71 and allows us to move the IAM roles into template deploy with https://github.com/ministryofjustice/template-deploy/pull/23

@mattmb
Copy link
Contributor Author

mattmb commented Apr 13, 2015

@ashb @stuartornum here's the new approach as we discussed for review.

includes:
- /path/to/cloudformation.json

The tool will then merge this with the generated template *overwriting* any keys in the original template that clash.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite clear on two counts:

  1. What's a key? (Are we talking a matching logical resource id)
  2. That we do deep merging (i.e. we're not overwriting the Output section entirely.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will try to make it clearer. Quite hard to explain deep merging in English though!

@ashb
Copy link
Contributor

ashb commented Apr 13, 2015

The few minor comments above not withstanding this PR actually does three completely separate things

  1. It adds the ability to include static snippets of Cloudformation JSON
  2. It lets you use the sts AssumeRole to target another account
  3. It fixes the PYTHONPATH issue in the deploy script.

These happen to be related since you want them all, but even your commits show that it's three features (the first three commits are point 1, next is point 2 and last is point 3). Sorry to be a pain but can you split into three different PRs please?

@ashb
Copy link
Contributor

ashb commented Apr 14, 2015

(Or at least come up with a better PR title encompasses all the features)

@mattmb
Copy link
Contributor Author

mattmb commented Apr 14, 2015

Yeah, wasn't sure whether to split or not. I feel like it's kind of one story so nice to have in one place but they are quite distinct features. I think there's some good history in this PR, so I'd rather leave it be if you're happy for me to rename it and tidy up the description :-)

@mattmb mattmb changed the title Template includes Cross account IAM roles Apr 14, 2015
@mattmb mattmb changed the title Cross account IAM roles Cross account IAM deployment Apr 14, 2015
@ashb
Copy link
Contributor

ashb commented Apr 14, 2015

Title is much better now 👍.

It looks like you need to rebase this onto master at least - possibly squash a few of the commits too in the process (but not all of them)

Also can you document AWS_ROLE_ARN_ID (and possibly how you would get it) and add a changelog entry for this feature.

mattmb added 2 commits April 14, 2015 10:35
Moving dictionary deep merge to utils module so that it is easier to
reuse accross classes.
This adds the option to include extra cloudformation json from a static
file. The includes are merged with the template we generate, overwriting
existing keys that clash.
mattmb added 4 commits April 14, 2015 10:45
This adds an extra bit of code to the AWS api connection utility so
that it is possible to assume an IAM role from another account (if your
user has the right to). The ARN id of the role to assume is expected as
an environment variable.
This adds the path explicitly in the salt_utils module so that a user
with limited access does not have to set their PYTHONPATH.
This commit fixes a couple of mistakes in the merging code for included
cloudformation templates. It also makes the documentation clearer on how
the merge works.
@mattmb
Copy link
Contributor Author

mattmb commented Apr 14, 2015

@ashb rebased and tidy up 😄

ashb added a commit that referenced this pull request Apr 14, 2015
@ashb ashb merged commit 3e1f2eb into master Apr 14, 2015
@ashb ashb removed the in progress label Apr 14, 2015
@ashb ashb deleted the feature/extend-template branch April 14, 2015 13:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants