-
Notifications
You must be signed in to change notification settings - Fork 2
Allow extra permissions for lambda role #29
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,3 +54,57 @@ variable "create_test_url" { | |
| type = bool | ||
| default = false | ||
| } | ||
|
|
||
| # We need the stable keys for the additional policy ARNs because with a list | ||
| # of ARNs, we either have problems with foreach on objects that are created | ||
| # in the same plan, or we have problems with count/index which makes | ||
| # resources index (order) dependent. So arbitrary stable labels are a better | ||
| # solution. | ||
| variable "additional_managed_policy_arns" { | ||
| description = "Additional IAM managed policy ARNs to attach to the Lambda execution role, keyed by stable labels." | ||
| type = map(string) | ||
| default = {} | ||
|
|
||
| validation { | ||
| condition = length(var.additional_managed_policy_arns) <= 10 | ||
| error_message = "additional_managed_policy_arns may contain at most 10 managed policy ARNs." | ||
| } | ||
|
|
||
| validation { | ||
| condition = alltrue([ | ||
| for label in keys(var.additional_managed_policy_arns) : | ||
| can(regex("^[A-Za-z0-9_-]+$", label)) | ||
| ]) | ||
| error_message = "additional_managed_policy_arns keys must match ^[A-Za-z0-9_-]+$." | ||
| } | ||
|
|
||
| validation { | ||
| condition = alltrue([ | ||
| for policy_arn in values(var.additional_managed_policy_arns) : | ||
| can(regex("^arn:[^:]+:iam::(aws|[0-9]{12}):policy/[A-Za-z0-9+=,.@_/-]+$", trimspace(policy_arn))) | ||
| ]) | ||
| error_message = "additional_managed_policy_arns values must be IAM managed policy ARNs." | ||
| } | ||
| } | ||
|
|
||
| variable "additional_inline_policies" { | ||
| description = "Additional inline IAM policy JSON documents to attach to the Lambda execution role, keyed by stable labels." | ||
| type = map(string) | ||
| default = {} | ||
|
|
||
| validation { | ||
| condition = alltrue([ | ||
| for label in keys(var.additional_inline_policies) : | ||
| can(regex("^[A-Za-z0-9_-]+$", label)) | ||
| ]) | ||
| error_message = "additional_inline_policies keys must match ^[A-Za-z0-9_-]+$." | ||
| } | ||
|
|
||
| validation { | ||
| condition = alltrue([ | ||
| for policy_json in values(var.additional_inline_policies) : | ||
| can(regex("\\S", policy_json)) && can(jsondecode(policy_json)) | ||
| ]) | ||
| error_message = "additional_inline_policies values must be non-empty JSON strings." | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an incorrect statement. There's a limit of 10 managed policies, but you can have as many inline as your want (although there is a limit on total length.)
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an incorrect statement. There's a limit of 10 managed policies, but you can have as many inline as your want (although there is a limit on total length.)
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entity-length