From e5223b4c49e608a0e8c2b5953e65b27ad2cc4275 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 3 Jan 2020 09:54:37 +0100 Subject: [PATCH] terraform: disable cloudfront root object for crates.io on staging There is a concern that setting the default root object to index.html for the crates.io webapp causes Fastboot to break: https://github.com/rust-lang/crates.io/pull/1937#issuecomment-570452017 This adds a temporary feature flag to remove the default root object just from staging, without affecting production. After testing is done the feature flag will have to be removed, either disabling or enabling the root object both on staging and production. --- terraform/services.tf | 3 +++ terraform/services/cratesio/cloudfront-webapp.tf | 2 +- terraform/services/cratesio/variables.tf | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/terraform/services.tf b/terraform/services.tf index 39ea05cf..0c60059d 100644 --- a/terraform/services.tf +++ b/terraform/services.tf @@ -103,6 +103,7 @@ module "service_cratesio" { iam_prefix = "crates-io" logs_bucket = aws_s3_bucket.temp_logs_cratesio.bucket_domain_name + temp_flag_root_object = true } module "service_cratesio_staging" { @@ -122,6 +123,8 @@ module "service_cratesio_staging" { webapp_origin_domain = "staging-crates-io.herokuapp.com" iam_prefix = "staging-crates-io" + + temp_flag_root_object = false } module "service_docsrs" { diff --git a/terraform/services/cratesio/cloudfront-webapp.tf b/terraform/services/cratesio/cloudfront-webapp.tf index b2a54a8e..998cea8d 100644 --- a/terraform/services/cratesio/cloudfront-webapp.tf +++ b/terraform/services/cratesio/cloudfront-webapp.tf @@ -6,7 +6,7 @@ resource "aws_cloudfront_distribution" "webapp" { enabled = true wait_for_deployment = false is_ipv6_enabled = true - default_root_object = "index.html" + default_root_object = var.temp_flag_root_object ? "index.html" : null price_class = "PriceClass_All" aliases = [var.webapp_domain_name] diff --git a/terraform/services/cratesio/variables.tf b/terraform/services/cratesio/variables.tf index 4732f5a8..f2caced7 100644 --- a/terraform/services/cratesio/variables.tf +++ b/terraform/services/cratesio/variables.tf @@ -36,3 +36,7 @@ variable "logs_bucket" { type = string default = null } + +variable "temp_flag_root_object" { + type = bool +}