Skip to content

Commit 58b90db

Browse files
committed
Fixed CloudFront Origin Shield region selection
1 parent 118ee8d commit 58b90db

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [0.2.1] - 2024-02-28
4+
### Fixed
5+
- Fixed CloudFront Origin Shield region selection.
6+
37
## [0.2.0] - 2024-02-26
48
### Added
59
- Added `HowToConfigure` output.

template.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,51 @@ Conditions:
163163
- !Ref 'CreateCloudFrontDistribution'
164164
- 'Yes'
165165

166+
Mappings:
167+
OriginShieldRegionMap:
168+
# Regions with origin shield
169+
us-east-2:
170+
Region: us-east-2
171+
us-east-1:
172+
Region: us-east-1
173+
us-west-2:
174+
Region: us-west-2
175+
ap-south-1:
176+
Region: ap-south-1
177+
ap-northeast-2:
178+
Region: ap-northeast-2
179+
ap-southeast-1:
180+
Region: ap-southeast-1
181+
ap-southeast-2:
182+
Region: ap-southeast-2
183+
ap-northeast-1:
184+
Region: ap-northeast-1
185+
eu-central-1:
186+
Region: eu-central-1
187+
eu-west-1:
188+
Region: eu-west-1
189+
eu-west-2:
190+
Region: eu-west-2
191+
sa-east-1:
192+
Region: sa-east-1
193+
# Regions without origin shield
194+
us-west-1:
195+
Region: us-west-2
196+
af-south-1:
197+
Region: eu-west-1
198+
ap-east-1:
199+
Region: ap-southeast-1
200+
ca-central-1:
201+
Region: us-east-1
202+
eu-south-1:
203+
Region: eu-central-1
204+
eu-west-3:
205+
Region: eu-west-2
206+
eu-north-1:
207+
Region: eu-west-2
208+
me-south-1:
209+
Region: ap-south-1
210+
166211
Resources:
167212
ImgproxyFunction:
168213
Type: AWS::Serverless::Function
@@ -319,7 +364,10 @@ Resources:
319364
OriginPath: !Ref 'PathPrefix'
320365
OriginShield:
321366
Enabled: true
322-
OriginShieldRegion: !Ref 'AWS::Region'
367+
OriginShieldRegion: !FindInMap
368+
- OriginShieldRegionMap
369+
- !Ref 'AWS::Region'
370+
- Region
323371
DefaultCacheBehavior:
324372
TargetOriginId: !Join
325373
- '-'

0 commit comments

Comments
 (0)