@cryptotaxi247 / infra / commits / bf810ae1

partially migrate from deprecated inline website configuration

Arian van Putten committed Jun 9, 2025 at 15:57 UTC bf810ae16c686800a298acab895d7f1d139c8d26
2 files changed +31 -5
terraform/channels.tf
+17 -3
@@ -10,18 +10,32 @@ locals {
10 # Use the website endpoint because the bucket is configured with website
11 # enabled. This also means we can't use TLS between Fastly and AWS because
12 # the website endpoint only has port 80 open.
13 - channels_backend = aws_s3_bucket.channels.website_endpoint
13 + channels_backend = aws_s3_bucket.nixpkgs-tarballs.website_endpoint
14 + # NOTE: I'd wish to use the below line to get rid of deprecation errors but then the fastly provider panics
15 + # see https://github.com/fastly/terraform-provider-fastly/issues/884
16 + # and https://gist.github.com/arianvp/263cbe52b00620bcbc388ffde8b45876
17 + # channels_backend = aws_s3_bucket_website_configuration.channels.website_endpoint
18 }
19
20 resource "aws_s3_bucket" "channels" {
21 provider = aws.us
22 bucket = "nix-channels"
23 +}
24 +
25 +resource "aws_s3_bucket_website_configuration" "channels" {
26 + provider = aws.us
27 + bucket = aws_s3_bucket.channels.id
28
20 - website {
21 - index_document = "index.html"
29 + index_document {
30 + suffix = "index.html"
31 }
32 }
33
34 +import {
35 + to = aws_s3_bucket_website_configuration.channels
36 + id = aws_s3_bucket.channels.id
37 +}
38 +
39 resource "aws_s3_bucket_cors_configuration" "channels" {
40 provider = aws.us
41 bucket = aws_s3_bucket.channels.id
terraform/nixpkgs-tarballs.tf
+14 -2
@@ -4,16 +4,28 @@ locals {
4 # enabled. This also means we can't use TLS between Fastly and AWS because
5 # the website endpoint only has port 80 open.
6 tarballs_backend = aws_s3_bucket.nixpkgs-tarballs.website_endpoint
7 + # NOTE: I'd wish to use the below line to get rid of deprecation errors but then the fastly provider panics
8 + # see https://github.com/fastly/terraform-provider-fastly/issues/884
9 + # and https://gist.github.com/arianvp/263cbe52b00620bcbc388ffde8b45876
10 + # tarballs_backend = aws_s3_bucket_website_configuration.nixpkgs-tarballs.website_endpoint
11 }
12
13 resource "aws_s3_bucket" "nixpkgs-tarballs" {
14 bucket = "nixpkgs-tarballs"
15 +}
16
12 - website {
13 - index_document = "index.html"
17 +resource "aws_s3_bucket_website_configuration" "nixpkgs-tarballs" {
18 + bucket = aws_s3_bucket.nixpkgs-tarballs.id
19 + index_document {
20 + suffix = "index.html"
21 }
22 }
23
24 +import {
25 + to = aws_s3_bucket_website_configuration.nixpkgs-tarballs
26 + id = aws_s3_bucket.nixpkgs-tarballs.id
27 +}
28 +
29 resource "aws_s3_bucket_policy" "nixpkgs-tarballs" {
30 bucket = aws_s3_bucket.nixpkgs-tarballs.id
31