-
-
Notifications
You must be signed in to change notification settings - Fork 29
Allow Lambda in us-east-1 required for cloudfront lambda on edge #65
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
base: main
Are you sure you want to change the base?
Changes from all commits
5a5e8e9
4c345de
bc88c88
83788a9
0331471
207e5e2
09e00f7
5326cb6
ecca15e
ffc8411
06fa1d9
f20f8d9
1a4b68f
c9ad718
58c7626
ecd696e
c30f164
8319c94
4c1b16d
4bad256
3340d6c
6ece39f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "iam:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "importexport:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "kms:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ if cloudfront_lambda_edge_enabled == "true" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "lambda:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endif } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "mobileanalytics:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "networkmanager:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "organizations:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -37,6 +40,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "s3:GetAccountPublic*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "s3:ListAllMyBuckets" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "s3:PutAccountPublic*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ if servicequotas_enabled == "true" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "servicequotas:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endif } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+43
to
+45
Contributor
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. You need to handle |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "shield:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "sts:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "support:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -56,3 +62,20 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endfor } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - sid: "DenyLambdaInRegions" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| effect: "Deny" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| actions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "lambda:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| condition: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - test: "StringEqualsIgnoreCase" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| variable: "aws:RequestedRegion" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # List of denied regions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| values: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ for r in split(",", denied_regions) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ if cloudfront_lambda_edge_enabled != "true" || trimspace(r) != "us-east-1" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - ${trimspace(r)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endif } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endfor } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+66
to
+81
Contributor
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 entire statement is not needed unless
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "iam:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "importexport:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "kms:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ if cloudfront_lambda_edge_enabled == "true" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "lambda:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endif } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+33
Contributor
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. Same idea as with
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "mobileanalytics:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "networkmanager:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "organizations:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -37,6 +40,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "s3:GetAccountPublic*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "s3:ListAllMyBuckets" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "s3:PutAccountPublic*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ if servicequotas_enabled == "true" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "servicequotas:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endif } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+43
to
+45
Contributor
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. Again, needs to be handled like |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "shield:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "sts:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "support:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -56,3 +62,22 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endfor } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - sid: "RestrictLambdaToSpecifiedRegions" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| effect: "Deny" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| actions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "lambda:*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| condition: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - test: "StringNotEqualsIgnoreCase" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| variable: "aws:RequestedRegion" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # List of allowed regions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| values: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Us east-1 required for cloudfront lambda on edge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ if cloudfront_lambda_edge_enabled == "true" && !contains(split(",", allowed_regions), "us-east-1") } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - us-east-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endif } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ for r in split(",", allowed_regions) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - ${trimspace(r)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %{ endfor } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "*" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+66
to
+83
Contributor
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. Same idea as with
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 good: if
cloudfront_lambda_edge_enabled != true(the default, right?), then the rule is not changed, and there will be no Terraform drift.However, let's clean up the whitespace and remove the redundant condition