Skip to content
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

Logging of API calls and impacted resources for generating IAM policy permissions #1768

Closed
cristim opened this issue Feb 2, 2018 · 3 comments
Labels
feature-request A feature should be added or improved.

Comments

@cristim
Copy link

cristim commented Feb 2, 2018

This is a question/feature request.

Problem

I am sometimes spending a lot of time and effort creating fine-grained IAM policies for relatively large Terraform stacks.

Proposal

It would be nice to be able to generate the minimal IAM policies straight from the SDK, since it knows which calls it performs against which resources.

When a magic environment variable is set, all these API calls should be dumped to a file that is formatted as close as possible to the permissions part of a IAM policy, where it could be included with minimal if any changes.

@jasdel jasdel added the feature-request A feature should be added or improved. label Feb 2, 2018
@jasdel
Copy link
Contributor

jasdel commented Feb 5, 2018

Thanks for creating this issue @cristim. Is similar to #127 in the SDK's backlog? Or are you looking for an option to track the API calls that are made with the SDK?

I think a feature similar to this can be enabled today with the SDK's request handlers. The Complete request handler is probably the easiest one to use for this tracking.

The following example will add a logger of service api calls for all APIs made from a client created from a session.

sess := session.Must(session.NewSession())
sess.Handlers.Complete.PushBack(func(r *request.Request) {
    fmt.Printf("region:%s, service:%s, api:%s\n",
        *r.Config.Region,
        r.ClientInfo.ServiceName,
        r.Operation.Name,
})

// make service api calls, 

@cristim
Copy link
Author

cristim commented Feb 6, 2018

@jasdel that issue seems to be about generating policy data structures that can accommodate and compare equally for different formatting of the JSON.

This one is just a special kind of logging that would be allow users to generate policy documents for a given program using the SDK.

Maybe that policy data structure could be used for collecting this logging information throughout the execution of the program and then dump it to a policy json/yaml file right before exiting.

@github-actions
Copy link

We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

2 participants