Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to SF as primary #2706

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions deploy/infrastructure/prod/us-east-2/cloudfront.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
locals {
indexstar_origin_id = "${local.environment_name}_${local.region}_indexstar"
indexstar_berg_origin_id = "${local.environment_name}_${local.region}_indexstar_berg"
indexstar_sf_origin_id = "${local.environment_name}_${local.region}_indexstar_sf"
indexstar_primary = local.indexstar_berg_origin_id
http_announce_origin_id = "${local.environment_name}_${local.region}_assigner"
cdn_subdomain = "cdn"
cf_log_bucket = "${local.environment_name}-${local.region}-cf-log"
indexstar_origin_id = "${local.environment_name}_${local.region}_indexstar"
indexstar_berg_origin_id = "${local.environment_name}_${local.region}_indexstar_berg"
indexstar_sf_origin_id = "${local.environment_name}_${local.region}_indexstar_sf"
indexstar_primary = local.indexstar_sf_origin_id
http_announce_origin_id = "${local.environment_name}_${local.region}_assigner"
cdn_subdomain = "cdn"
cf_log_bucket = "${local.environment_name}-${local.region}-cf-log"
}

resource "aws_s3_bucket" "cf_logs" {
Expand Down Expand Up @@ -47,7 +47,7 @@ resource "aws_cloudfront_distribution" "cdn" {
http_port = 80
https_port = 443
origin_protocol_policy = "https-only"
origin_ssl_protocols = ["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"]
origin_ssl_protocols = ["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"]
}
origin_shield {
enabled = true
Expand All @@ -68,7 +68,7 @@ resource "aws_cloudfront_distribution" "cdn" {
http_port = 80
https_port = 443
origin_protocol_policy = "https-only"
origin_ssl_protocols = ["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"]
origin_ssl_protocols = ["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"]
}
origin_shield {
enabled = true
Expand All @@ -84,7 +84,7 @@ resource "aws_cloudfront_distribution" "cdn" {
http_port = 80
https_port = 443
origin_protocol_policy = "https-only"
origin_ssl_protocols = ["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"]
origin_ssl_protocols = ["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"]
}
origin_shield {
enabled = true
Expand All @@ -100,7 +100,7 @@ resource "aws_cloudfront_distribution" "cdn" {
http_port = 80
https_port = 443
origin_protocol_policy = "https-only"
origin_ssl_protocols = ["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"]
origin_ssl_protocols = ["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"]
}
origin_shield {
enabled = true
Expand All @@ -116,8 +116,8 @@ resource "aws_cloudfront_distribution" "cdn" {
default_cache_behavior {
# We need to allow GET and PUT. CloudFront does not support configuring allowed methods selectively.
# Hence the complete method list.
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "PATCH", "POST"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "PATCH", "POST"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
target_origin_id = local.indexstar_primary

forwarded_values {
Expand All @@ -138,8 +138,8 @@ resource "aws_cloudfront_distribution" "cdn" {
path_pattern = "multihash/*"
# CloudFront does not support configuring allowed methods selectively.
# Hence the complete method list.
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "PATCH", "POST"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "PATCH", "POST"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
target_origin_id = local.indexstar_primary
cache_policy_id = aws_cloudfront_cache_policy.lookup.id

Expand All @@ -149,8 +149,8 @@ resource "aws_cloudfront_distribution" "cdn" {

ordered_cache_behavior {
path_pattern = "cid/*"
allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
target_origin_id = local.indexstar_primary
cache_policy_id = aws_cloudfront_cache_policy.lookup.id

Expand All @@ -160,8 +160,8 @@ resource "aws_cloudfront_distribution" "cdn" {

ordered_cache_behavior {
path_pattern = "providers"
allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
target_origin_id = local.indexstar_primary
forwarded_values {
query_string = false
Expand All @@ -180,8 +180,8 @@ resource "aws_cloudfront_distribution" "cdn" {
path_pattern = "ingest/*"
# CloudFront does not support configuring allowed methods selectively.
# Hence the complete method list.
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "PATCH", "POST"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE", "PATCH", "POST"]
cached_methods = ["GET", "HEAD", "OPTIONS"]
target_origin_id = local.indexstar_primary
forwarded_values {
query_string = false
Expand Down Expand Up @@ -244,16 +244,16 @@ provider "aws" {
}

module "cdn_cert" {
source = "registry.terraform.io/terraform-aws-modules/acm/aws"
source = "registry.terraform.io/terraform-aws-modules/acm/aws"
version = "4.3.2"

# Certificate must be in us-east-1 as dictated by CloudFront
providers = {
aws = aws.use1
}

domain_name = aws_route53_zone.prod_external.name
zone_id = aws_route53_zone.prod_external.zone_id
domain_name = aws_route53_zone.prod_external.name
zone_id = aws_route53_zone.prod_external.zone_id
subject_alternative_names = ["*.${aws_route53_zone.prod_external.name}"]

tags = local.tags
Expand All @@ -267,8 +267,8 @@ module "records" {

records = [
{
name = local.cdn_subdomain
type = "A"
name = local.cdn_subdomain
type = "A"
alias = {
name = aws_cloudfront_distribution.cdn.domain_name
zone_id = aws_cloudfront_distribution.cdn.hosted_zone_id
Expand All @@ -278,7 +278,7 @@ module "records" {
}

module "cid_contact_cert" {
source = "registry.terraform.io/terraform-aws-modules/acm/aws"
source = "registry.terraform.io/terraform-aws-modules/acm/aws"
version = "4.3.2"

# Certificate must be in us-east-1 as dictated by CloudFront
Expand Down
Loading