Skip to content

Commit

Permalink
Fix cloudfront setup when no request policies exist
Browse files Browse the repository at this point in the history
Setup fails when no cloudfront policies exist in an account. This
likely happens if the account is new or CloudFront hasn't been used
with it before.
  • Loading branch information
RyanJarv committed Apr 24, 2022
1 parent 18e3212 commit f033d24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cdn_proxy/cloudfront/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def create_distribution(self, lambda_arn):

resp = client.list_origin_request_policies(Type="custom")

for policy in resp["OriginRequestPolicyList"]["Items"]:
for policy in resp["OriginRequestPolicyList"].get("Items", []):
if policy["OriginRequestPolicy"]["OriginRequestPolicyConfig"]["Name"] == policy_name:
policy_id = policy["OriginRequestPolicy"]["Id"]

Expand Down

0 comments on commit f033d24

Please sign in to comment.