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

Tidy up some pieces around wellcomecollection.org subdomains #323

Merged
merged 6 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion cloudfront/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ You can find the infra for most of the CloudFront distributions / DNS records de
- [reporting.wellcomecollection.org](https://github.com/wellcomecollection/platform-infrastructure/tree/master/cloudfront/reporting.wellcomecollection.org): Internal Search/Collections data Kibana instance
- [roadmap.wellcomecollection.org](https://github.com/wellcomecollection/platform-infrastructure/tree/master/cloudfront/roadmap.wellcomecollection.org): Public facing product roadmap
- [wellcomecollection.org](https://github.com/wellcomecollection/platform-infrastructure/tree/master/cloudfront/wellcomecollection.org): DNS only for wellcomecollection.org apex records.
- [wellcomelibrary.org](https://github.com/wellcomecollection/platform-infrastructure/tree/master/cloudfront/wellcomelibrary.org): Redirection for the old Wellcome Library site

## Missing pieces

Expand Down
12 changes: 0 additions & 12 deletions cloudfront/wellcomecollection.org/terraform/locals.tf

This file was deleted.

76 changes: 31 additions & 45 deletions cloudfront/wellcomecollection.org/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,63 +1,49 @@
# Third-party services
resource "aws_route53_record" "docs" {
zone_id = data.aws_route53_zone.weco_zone.id
name = "docs.wellcomecollection.org"
type = "CNAME"
records = ["hosting.gitbook.com"]
ttl = "300"
locals {
# CNAME records for third party services.
subdomain_cname_records = {

provider = aws.dns
}
# This is for our Chromatic instance of Storybook.
# It will be up to date with what's in the main branch.
"cardigan.wellcomecollection.org" = "domains.chromatic.com"

// This adds a CNAME record for our Chromatic instance of Storybook.
// It will be up to date with what's in the main branch.
resource "aws_route53_record" "cardigan" {
zone_id = data.aws_route53_zone.weco_zone.id
name = "cardigan.wellcomecollection.org"
type = "CNAME"
records = ["domains.chromatic.com"]
ttl = "300"
# This is our GitBook instance.
"docs.wellcomecollection.org" = "hosting.gitbook.com"

provider = aws.dns
}
# This is the front-end to rank, our tool for testing API search quality.
# See https://github.com/wellcomecollection/catalogue-api/tree/main/rank
"rank.wellcomecollection.org" = "cname.vercel-dns.com"

resource "aws_route53_record" "rank" {
zone_id = data.aws_route53_zone.weco_zone.id
name = "rank.wellcomecollection.org"
type = "CNAME"
records = ["cname.vercel-dns.com"]
ttl = "300"
# See https://help.shopify.com/en/manual/online-store/os/domains/add-a-domain/using-existing-domains/connecting-domains#set-up-your-existing-domain-to-connect-to-shopify
"shop.wellcomecollection.org" = "shops.myshopify.com"

provider = aws.dns
}

// This adds a CNAME record for Atlassion Statuspage (https://wellcomecollection.statuspage.io/)
resource "aws_route53_record" "status" {
zone_id = data.aws_route53_zone.weco_zone.id
name = "status.wellcomecollection.org"
type = "CNAME"
records = ["qyhn8w55666p.stspg-customer.com"]
ttl = "300"
# Atlassion Statuspage (https://wellcomecollection.statuspage.io/)
"status.wellcomecollection.org" = "qyhn8w55666p.stspg-customer.com"
}

provider = aws.dns
# Subdomains that should be redirected to wellcomecollection.org
redirect_subdomains_to_apex = [
"www.wellcomecollection.org",
]
}

# See https://help.shopify.com/en/manual/online-store/os/domains/add-a-domain/using-existing-domains/connecting-domains#set-up-your-existing-domain-to-connect-to-shopify
resource "aws_route53_record" "subdomains" {
for_each = local.subdomain_cname_records

name = each.key
records = [each.value]

resource "aws_route53_record" "shop" {
zone_id = data.aws_route53_zone.weco_zone.id
name = "shop.${data.aws_route53_zone.weco_zone.name}"
type = "CNAME"
ttl = "300"
records = ["shops.myshopify.com"]
ttl = 300

provider = aws.dns
}

# Redirects
module "www" {
source = "../../modules/redirect"
from = "www.wellcomecollection.org"
module "redirects" {
for_each = toset(local.redirect_subdomains_to_apex)
source = "../../modules/redirect"

from = each.key
to = "wellcomecollection.org"
zone_id = data.aws_route53_zone.weco_zone.id

Expand Down
12 changes: 0 additions & 12 deletions cloudfront/wellcomecollection.org/terraform/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,3 @@ terraform {
}
}
}

data "terraform_remote_state" "identity" {
backend = "s3"

config = {
role_arn = "arn:aws:iam::770700576653:role/identity-developer"

bucket = "identity-static-remote-state"
key = "terraform.tfstate"
region = "eu-west-1"
}
}