-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Implement a subset of IAM resources #939
Conversation
This actually all looks really good. Can you add acceptance tests? Once that is in, I'm happy to merge. Thanks for doing docs, as well. |
I'll give it a shot. Might be some days or weeks. |
👍 diff --git a/website/source/layouts/aws.erb b/website/source/layouts/aws.erb
index 030192d..e14ba79 100644
--- a/website/source/layouts/aws.erb
+++ b/website/source/layouts/aws.erb
@@ -41,6 +41,18 @@
<a href="/docs/providers/aws/r/elb.html">aws_elb</a>
</li>
+ <li<%= sidebar_current("docs-aws-resource-iam=access-key") %>>
+ <a href="/docs/providers/aws/r/iam_access_key.html">aws_iam_access_key</a>
+ </li>
+
+ <li<%= sidebar_current("docs-aws-resource-iam-user") %>>
+ <a href="/docs/providers/aws/r/iam_user.html">aws_iam_user</a>
+ </li>
+
+ <li<%= sidebar_current("docs-aws-resource-iam-user-policy") %>>
+ <a href="/docs/providers/aws/r/iam_user_policy.html">aws_iam_user_policy</a>
+ </li>
+
<li<%= sidebar_current("docs-aws-resource-instance") %>>
<a href="/docs/providers/aws/r/instance.html">aws_instance</a>
</li> and it would be nice to have Most importantly some more significant changes will need to be done to make it work with the new |
Agreed, @radeksimko. Thanks for the feedback. I will tackle those issues eventually. Currently I'm focused on delivering an internal demo and proof of concept, but when that's done (and successful, I hope), I'll be making a finishing pass over this and many other things. Still some ways out on my priority list, however. |
d33908a
to
92c00ee
Compare
I've updated the website as @radeksimko suggested, and updated to use aws-sdk-go. Still needs some work on the rough edges, and acceptance tests. |
aeb5e71
to
5b3f73b
Compare
@radeksimko roles and instance profiles are implemented now. I did some horrible copy&paste to implement groups/users/roles, which really are almost exactly the same file. I'll have to do some thinking on how to clean that up. Also, I didn't implement IAM managed policies because the vendored AWS SDK didn't support them. But I see now that the current version from aws-labs which does support policies is in use in places -- is migrating to that the goal? |
I believe it is, @catsby started migrating all existing AWS resources over back to the vendored AWS SDK. I would probably hold on until all the resources are migrated and "workarounds" (like import aliases) removed, then I'd update the code so it uses the vendored version. |
I'm in the process of migrating to the upstream awslabs version of @bitglue to my knowledge, RDS is the only resource currently using the |
@catsby is there anything you could use some help with in the awslabs migration? |
@fromonesrc I created #1488 to track the migrations |
On Apr 10, 2015 9:57 AM, "Clint" notifications@github.com wrote:
That would be super great. |
@bitglue I opened #1510 for converting RDS, and upgrading the IAM connection. I suppose the latter wasn't strictly needed, but I wanted to rid the resource of |
@catsby Thanks for doing that. I've rebased to the current master so this should now work with the awslabs SDK. |
This is the biggest missing piece for me right now with managing our environment. +1 for the feature. |
I've added a number of basic acceptance tests on top of these commits here: #1591. Hopefully this gets us to a point where we can merge this in. |
If we can wait a day or two, I'm adding a resource for managed policies. And I do have a clean account, so I'll give @johnrengelman's tests a run. |
ade9e60
to
bdd0ab5
Compare
I found some issues in testing this on my own aws account. When creating everything from an aws_iam_role, aws_iam_role_policy, aws_iam_instance_profile, and an aws_instance terraform operates too quickly for changes to propagate. So what seems to happen is that aws_iam_instance_profile gets "created" but when aws_instance attempts to spin up an EC2 instance the aws_iam_instance_profile resource is not yet ready. Essentially I see the following error:
I may have some time to look at this over the course of this week, but I just wanted to make sure that this problem was known. Just in case someone had some ideas off the top of their head. |
@ravenac95 I've never had that happen to me. Do you have a repro case you can share? |
9f7e355
to
0d6674f
Compare
@bitglue here's what I have that consistently breaks. (There's a step by step at the bottom) In test.tf:
Then in a test.tfvars file:
First, let me know if I'm doing something silly here. Perhaps I just misconfigured something. Step-by-Step Reproduction
|
Hey all – how do we feel about the state of this pull request? Are there questions/issues outstanding, or do you feel it's ready to be merged? |
I think the errors being described above are likely AWS "eventual consistency" type things. So I think we should merge this to get it out there and then fix those types of errors as the come up. |
Agree. |
@ravenac95 thanks for the repro case, BTW. I can reproduce, but I don't have the bandwidth to fix it now. I thought maybe #1732 would be a way forward. If this gets merged, probably you should move the repro case to a new issue. |
@bitglue No worries. I may poke around (terraform as a whole) to see if there's any way to bring a better solution to AWS's eventual consistency, but for the most part I think the problems encountered by my case are not indicative of a problem in this PR but represent a problem at a higher level. So ya, I agree this should be merged as well :) |
Hey @bitglue – this looks awesome, thanks! We do have at least one request, and that is to break out the changes you have made here to schema helper, with the Let us know if you can work on that, and thanks again! |
@catsby It's already a separate commit. If you want to merge it separately, I think just |
Sets of strings are pretty common. Let's not duplicate the function necessary to create a set of strings in so many places.
- Users - Groups - Roles - Inline policies for the above three - Instance profiles - Managed policies - Access keys This is most of the data types provided by IAM. There are a few things missing, but the functionality here is probably sufficient for 95% of the cases. Makes a dent in hashicorp#28.
Rebased to fix conflicts, so now that commit is |
You should probably just create a new PR from that commit so they can merge it with a button click. Just git the button from here: master...bitglue:33183c078bfb820d32a0135c5ec928aa88d77c5c |
No thanks. Then I'll have two PRs to keep coherent and free of conflicts. |
Pulling this in, thanks. |
Implement a subset of IAM resources
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Implements support for IAM users, user policies, and access keys. This
is only a subset of what IAM can do (notably missing: roles and instance
profiles and associated policies), but it's a start.
Makes a dent in #28.
The user policies and access keys are implemented as their own resources, rather than being sub-trees in the
aws_iam_user
, to support use cases where one module defines a user, and other modules add policies or keys.