Skip to content

Commit

Permalink
terraform: disable cloudfront root object for crates.io on staging
Browse files Browse the repository at this point in the history
There is a concern that setting the default root object to index.html
for the crates.io webapp causes Fastboot to break:

    rust-lang/crates.io#1937 (comment)

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.
  • Loading branch information
pietroalbini committed Jan 3, 2020
1 parent a20506e commit e5223b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions terraform/services.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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" {
Expand Down
2 changes: 1 addition & 1 deletion terraform/services/cratesio/cloudfront-webapp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions terraform/services/cratesio/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ variable "logs_bucket" {
type = string
default = null
}

variable "temp_flag_root_object" {
type = bool
}

0 comments on commit e5223b4

Please sign in to comment.