@@ -3,17 +3,27 @@ locals {
33 # Use the website endpoint because the bucket is configured with website
44 # enabled. This also means we can't use TLS between Fastly and AWS because
55 # the website endpoint only has port 80 open.
6- tarballs_backend = aws_s3_bucket. nixpkgs-tarballs . website_endpoint
6+ tarballs_backend = " nixpkgs-tarballs.s3-website-eu-west-1.amazonaws.com"
7+ # TODO: Uncomment this once has been applied once. This is to work around fastly bug https://github.com/fastly/terraform-provider-fastly/issues/884
8+ # tarballs_backend = aws_s3_bucket_website_configuration.nixpkgs-tarballs.website_endpoint
79}
810
911resource "aws_s3_bucket" "nixpkgs-tarballs" {
1012 bucket = " nixpkgs-tarballs"
13+ }
1114
12- website {
13- index_document = " index.html"
15+ resource "aws_s3_bucket_website_configuration" "nixpkgs-tarballs" {
16+ bucket = aws_s3_bucket. nixpkgs-tarballs . id
17+ index_document {
18+ suffix = " index.html"
1419 }
1520}
1621
22+ import {
23+ to = aws_s3_bucket_website_configuration. nixpkgs-tarballs
24+ id = aws_s3_bucket. nixpkgs-tarballs . id
25+ }
26+
1727resource "aws_s3_bucket_policy" "nixpkgs-tarballs" {
1828 bucket = aws_s3_bucket. nixpkgs-tarballs . id
1929
@@ -284,7 +294,7 @@ resource "fastly_tls_subscription" "nixpkgs-tarballs" {
284294
285295# TODO: move the DNS config to terraform
286296output "nixpkgs-tarballs-managed_dns_challenge" {
287- value = fastly_tls_subscription. nixpkgs-tarballs . managed_dns_challenge
297+ value = fastly_tls_subscription. nixpkgs-tarballs . managed_dns_challenges
288298}
289299
290300# Create an S3 bucket for CloudTrail logs
@@ -293,12 +303,21 @@ resource "aws_s3_bucket" "nixpkgs-tarballs-cloudtrail-logs" {
293303 # We can potentially make this public for transparency?
294304 # But first I want to see what the logs look like.
295305 acl = " private"
306+ }
296307
297- versioning {
298- enabled = true
308+ resource "aws_s3_bucket_versioning" "nixpkgs-tarballs-cloudtrail-logs" {
309+ bucket = aws_s3_bucket. nixpkgs-tarballs-cloudtrail-logs . id
310+ versioning_configuration {
311+ status = " Enabled"
299312 }
300313}
301314
315+
316+ import {
317+ to = aws_s3_bucket_versioning. nixpkgs-tarballs-cloudtrail-logs
318+ id = aws_s3_bucket. nixpkgs-tarballs-cloudtrail-logs . id
319+ }
320+
302321# Attach a policy to the CloudTrail logs S3 bucket
303322data "aws_iam_policy_document" "nixpkgs-tarballs-cloudtrail-logs-policy" {
304323 statement {
0 commit comments