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

Create constants for AWS service principals #322

Closed
jen20 opened this issue Sep 15, 2018 · 0 comments
Closed

Create constants for AWS service principals #322

jen20 opened this issue Sep 15, 2018 · 0 comments

Comments

@jen20
Copy link
Contributor

jen20 commented Sep 15, 2018

Since the function aws.iam.assumeRolePolicyForPrincipal was introduced, code such as this has been common:

const assumePolicy = aws.iam.assumeRolePolicyForPrincipal({
    Service: "vpc-flow-logs.amazonaws.com"
})

Personally I can only remember about three of the commonly used service principal addresses, but this is something where autocomplete can help out! If we export constants of the Principal structure for each service from the aws.iam namespace, this code could be rewritten:

const assumePolicy = aws.iam.assumeRolePolicyForPrincipal(aws.iam.VpcFlowLogsPrincpal)

This has the secondary benefit of being a one-liner, making it less obtrusive to declare directly in the input properties of the resource using the policy, reducing the number of names in scope.

Something to investigate is whether the constants might be better inside the aws.iam package or inside the package for each service with a common name (e.g. aws.ec2.ServicePrincipal, aws.lambda.ServicePrincipal). I am tending towards the former since some services have many principals available (EC2 being a good example), and if several are imported for use without the qualifying namespace they will not conflict.

jen20 added a commit to jen20/pulumi-aws that referenced this issue Sep 16, 2018
This commit adds service principals for each of the known AWS services,
in order to assist with autocompletion when writing trust policies for
IAM roles.

Fixes pulumi#322.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant