cache: authenticate Fastly<->S3 requests in preparation for Requester Pays
Configuration already tested to work on cache-staging.
Pierre Bourdon committed
Oct 28, 2023 at 13:49 UTC
e74c24c635bea8655774512b15acf3da0fcd9657
1 file changed
+14
terraform/cache.tf
+14
@@ -202,6 +202,20 @@ resource "fastly_service_vcl" "cache" {
202
status = 404
203
}
204
205
+ # Authenticate Fastly<->S3 requests. See Fastly documentation:
206
+ # https://docs.fastly.com/en/guides/amazon-s3#using-an-amazon-s3-private-bucket
207
+ snippet {
208
+ name = "Authenticate S3 requests"
209
+ type = "miss"
210
+ priority = 100
211
+ content = templatefile("${path.module}/cache/s3-authn.vcl", {
212
+ aws_region = aws_s3_bucket.cache.region
213
+ backend_domain = aws_s3_bucket.cache.bucket_domain_name
214
+ access_key = local.cache-iam.key
215
+ secret_key = local.cache-iam.secret
216
+ })
217
+ }
218
+
219
snippet {
220
content = "set req.url = querystring.remove(req.url);"
221
name = "Remove all query strings"